Class AbstractBinaryStoreReaderV1

java.lang.Object
com.illumon.iris.binarystore.AbstractBinaryStoreReader
com.illumon.iris.binarystore.AbstractBinaryStoreReaderV1
All Implemented Interfaces:
BinaryStoreReader, TableReader
Direct Known Subclasses:
BinaryStoreBufferProcessorV1, BinaryStoreReaderV1

public abstract class AbstractBinaryStoreReaderV1 extends AbstractBinaryStoreReader
Base for V1 binary store readers.

This class implements the reader for a self-descriptive binary format table.
A table is structured as following:
  • header, formatted as follows:
    • 4-byte signed int (numColumns)
    • For each column:
      • 0-terminated ascii string (column name)
      • 0-terminated ascii string (type name)
      • 4-byte signed int (type size - unused)
      • 4-byte signed int (metadata size)
      • metadata size bytes (metadata)
  • list of rows
    • (numColumns+7)/8 bytes (column presence bitmap)
    • For each non-null column:
      • Column data based on SupportedType encoding
  • Method Details

    • readHeader

      public void readHeader(ByteBuffer theBuffer) throws IOException, EofException
      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.
      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.
    • readRow

      public boolean readRow() throws IOException
      Read data into the internal dataBuffer in order to populate the entire row. This implementation calls AbstractBinaryStoreReader.readIntoByteBuffer(int, ByteBuffer) and AbstractBinaryStoreReader.readData(int, ByteBuffer). to read more data from the implementation-defined source. AbstractBinaryStoreReader.readData(int, ByteBuffer) is also called, which might attempt to read from the source.
      Returns:
      true if successful, false if EOF is encountered reading the initial mask.
      Throws:
      IOException - if EOF is encountered mid-row
    • getFlagGetter

      public RowGetter<Row.Flags> getFlagGetter()
      Description copied from interface: TableReader
      Retrieve the getter for the row flags.
      Returns:
      a getter that returns the flags for each row.
    • getApplicationVersion

      public int getApplicationVersion()
      The V1 binary store does not support an application version number, for backwards compatibility we always return zero, which means to use the most recent listener available.
      Returns:
      the file's application version