Package com.illumon.iris.binarystore
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:
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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreReader
AbstractBinaryStoreReader.MissingGetterException
Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.TableReader
TableReader.MissingPropertyGetterException
-
Field Summary
Fields inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreReader
columnNames, columnTypes, CONSUMER_BUFFER_SIZE, dataBuffer, mask, PRODUCER_BUFFER_SIZE, rowGetters, typeMetadata
-
Method Summary
Modifier and Type Method Description 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.RowGetter<Row.Flags>
getFlagGetter()
Retrieve the getter for the row flags.void
readHeader(ByteBuffer theBuffer)
This implementation callsAbstractBinaryStoreReader.readIntoByteBuffer(int, ByteBuffer)
andAbstractBinaryStoreReader.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.boolean
readRow()
Read data into the internal dataBuffer in order to populate the entire row.Methods inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreReader
getColumnNames, getColumnType, getGetter, getGetter, getTypeMetadataString, handleRecord, handleRow, readData, readDataBuffer, readHeader, readIntoByteBuffer, setRecordHandler, setRowHandler
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.binarystore.TableReader
close, getPropertyGetter, getRecordDataGetter, readAllEntries, readAllEntries, readEntry
-
Method Details
-
readHeader
This implementation callsAbstractBinaryStoreReader.readIntoByteBuffer(int, ByteBuffer)
andAbstractBinaryStoreReader.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
Read data into the internal dataBuffer in order to populate the entire row. This implementation callsAbstractBinaryStoreReader.readIntoByteBuffer(int, ByteBuffer)
andAbstractBinaryStoreReader.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
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
-