org.apache.cassandra.io.util

## Interface ChunkReader

- All Superinterfaces:
    java.lang.AutoCloseable, ReaderFileProxy, RebuffererFactory
  All Known Implementing Classes:
    CompressedChunkReader, CompressedChunkReader.Mmap, CompressedChunkReader.Standard

      public interface ChunkReader
      extends RebuffererFactory

  RandomFileReader component that reads data from a file into a provided buffer and may have requirements over the size and alignment of reads. A caching or buffer-managing rebufferer will reference one of these to do the actual reading. Note: Implementations of this interface must be thread-safe!

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `chunkSize()` Buffer size required for this rebufferer.
    `BufferType` | `preferredBufferType()` Specifies type of buffer the caller should attempt to give.
    `void` | `readChunk(long position, java.nio.ByteBuffer buffer)` Read the chunk at the given position, attempting to fill the capacity of the given buffer.

    - ### Methods inherited from interface org.apache.cassandra.io.util.RebuffererFactory

      `instantiateRebufferer`

    - ### Methods inherited from interface org.apache.cassandra.io.util.ReaderFileProxy

      `channel, close, fileLength, getCrcCheckChance`

- - ### Method Detail

    - #### readChunk

          void readChunk(long position,
                         java.nio.ByteBuffer buffer)

      Read the chunk at the given position, attempting to fill the capacity of the given buffer. The filled buffer must be positioned at 0, with limit set at the size of the available data. The source may have requirements for the positioning and/or size of the buffer (e.g. chunk-aligned and chunk-sized). These must be satisfied by the caller.

    - #### chunkSize

          int chunkSize()

      Buffer size required for this rebufferer. Must be power of 2 if alignment is required.

    - #### preferredBufferType

          BufferType preferredBufferType()

      Specifies type of buffer the caller should attempt to give. This is not guaranteed to be fulfilled.

Copyright © 2018 The Apache Software Foundation