Class BinaryStoreBufferProcessorV2

All Implemented Interfaces:
BinaryStoreBufferProcessor, BinaryStoreReader, TableReader

public class BinaryStoreBufferProcessorV2
extends AbstractBinaryStoreReaderV2
implements BinaryStoreBufferProcessor
V2 Binary Store. Enables processing buffers of binary data, without providing a source (other than the buffer). All methods for reading more data from a source are disabled.
  • Constructor Details

  • Method Details

    • close

      public void close() throws IOException
      Description copied from interface: TableReader
      Close the input source for this TableReader.
      Specified by:
      close in interface TableReader
      Throws:
      IOException
    • readData

      protected void readData​(int minAmount, ByteBuffer dataBuffer) throws IOException
      We never actually read any data in the BinaryStoreBufferProcessors, instead we have a buffer passed in by the caller. If we end up needing to read data, we throw an exception, indicating that there is insufficient data to read the record; and the caller should pass in additional data.
      Specified by:
      readData in class AbstractBinaryStoreReader
      Parameters:
      minAmount - caller wants this many additional bytes
      dataBuffer - put the bytes in ths buffer. Must have minAmount additional capacity.
      Throws:
      IOException
    • readIntoByteBuffer

      protected void readIntoByteBuffer​(int requiredSize, ByteBuffer theBuffer) throws IOException, EofException
      This method is called by the AbstractBinaryStoreReaderV2 when more data is needed (with the minimum size needed). If our buffer has enough data, then we simply return. If there is not enough data, then we throw a ReadDataException, so that the caller is aware we have insufficient data to process the record, and setDataBuffer must be called with additional data before we can process the record.
      Overrides:
      readIntoByteBuffer in class AbstractBinaryStoreReader
      Parameters:
      requiredSize - how many bytes of data are required to continue processing
      theBuffer - the data buffer to populate
      Throws:
      IOException - if we encounter an EOF mid row
      EofException - if no data is available from the file
    • setDataBuffer

      public void setDataBuffer​(ByteBuffer buffer, long sentTimestamp, long recvTimestamp)
      Description copied from interface: BinaryStoreBufferProcessor
      The BinaryStoreBufferProcessors do not read their own data, but rather receive it externally through this call.
      Specified by:
      setDataBuffer in interface BinaryStoreBufferProcessor
      Parameters:
      buffer - The buffer that this BinaryStoreBufferProcessor should consume data from.
      sentTimestamp - The time the buffer was produced, in microseconds from the epoch, or QueryConstants.NULL_LONG if unknown/unavailable
      recvTimestamp - The timestamp when the buffer was received, in microseconds from the epoch
    • readHeader

      public void readHeader​(ByteBuffer theBuffer) throws IOException, EofException
      Description copied from class: AbstractBinaryStoreReaderV2
      This implementation calls AbstractBinaryStoreReader.readIntoByteBuffer(int, ByteBuffer) and AbstractBinaryStoreReader.readData(int, ByteBuffer) to add bytes to the given buffer.
      The data buffer is required to be at the beginning (position==0).

      Inherited doc: Read a binary header from the given buffer. This interface does not dictate anything about the BinaryStore implementation in the buffer. Implementations might make implementation-dependent actions to fill the buffer if there isn't enough data. byteBuffer.position will be advanced by the size of the header.
      Specified by:
      readHeader in interface BinaryStoreReader
      Overrides:
      readHeader in class AbstractBinaryStoreReaderV2
      Parameters:
      theBuffer - buffer containing the header, in reading mode
      Throws:
      IOException - an exception derived from IOException may be thrown if there isn't enough data in the buffer.
      EofException - may be thrown if an underlying channel (if any) ends.
    • getPropertyGetter

      public <T> RowGetter<T> getPropertyGetter​(String property)
      Description copied from interface: TableReader
      Retrieve a getter for the specified internal property.
      Specified by:
      getPropertyGetter in interface TableReader
      Overrides:
      getPropertyGetter in class AbstractBinaryStoreReaderV2
      Parameters:
      property - The property to get a getter for
      Returns:
      A correctly typed getter for the property.