Package com.illumon.iris.binarystore
Class SwitchBinaryStoreReader
java.lang.Object
com.illumon.iris.binarystore.SwitchBinaryStoreReader
- All Implemented Interfaces:
SkipableTableReader
,TableReader
public class SwitchBinaryStoreReader extends Object implements SkipableTableReader
Reads the magic number and selects either a V1 or V2 binary store reader as appropriate.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.TableReader
TableReader.MissingPropertyGetterException
-
Field Summary
Fields Modifier and Type Field Description protected SkipableTableReader
tableReader
-
Constructor Summary
Constructors Constructor Description SwitchBinaryStoreReader(File file)
SwitchBinaryStoreReader(String fileName)
-
Method Summary
Modifier and Type Method Description void
close()
Close the input source for this TableReader.int
getApplicationVersion()
Get the application version associated with the file being read by this TableReader.int
getBinaryStoreFormat()
String[]
getColumnNames()
Get an array of all known column names.SupportedType
getColumnType(String columnName)
Get the SupportedType of the named column.RowGetter<Row.Flags>
getFlagGetter()
Retrieve the getter for the row flags.RowGetter
getGetter(String name)
Return a raw RowGetter for the column with the given name.<T> RowGetter<T>
getGetter(String name, Class<T> tClass)
Return a typed RowGetter for the column with the given name.Supplier<RecordData>
getRecordDataGetter()
Retrieve the getter for the RecordData.long
getSize()
String
getTypeMetadataString(String columnName)
Return a string summary of the named column's metadata.boolean
readEntry()
Read a record from the source, expecting that not all records will be Row records.boolean
readRow()
Deprecated.void
setBlocking(boolean blocking)
As implemented, blocking means sleep and retry.void
setRecordHandler(Runnable handler)
void
setRowHandler(Runnable handler)
void
skipToRecord(long recordNo)
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
getPropertyGetter, readAllEntries, readAllEntries
-
Field Details
-
Constructor Details
-
SwitchBinaryStoreReader
- Throws:
IOException
-
SwitchBinaryStoreReader
- Throws:
IOException
-
-
Method Details
-
getGetter
Description copied from interface:TableReader
Return a raw RowGetter for the column with the given name. RowGetter.get() will return Object.- Specified by:
getGetter
in interfaceTableReader
- Parameters:
name
- the column name- Returns:
- a RowGetter
-
getGetter
Description copied from interface:TableReader
Return a typed RowGetter for the column with the given name. RowGetter.get() will return type tClass.- Specified by:
getGetter
in interfaceTableReader
- Parameters:
name
- the column name- Returns:
- a RowGetter of type tClass
-
readRow
Deprecated.Description copied from interface:TableReader
Read a row from the source, expecting that all entries will be Rows. If a record entry is encountered, anIllegalStateException
will be thrown.- Specified by:
readRow
in interfaceTableReader
- Returns:
- true if successful, false if EOF or an error is encountered.
- Throws:
IOException
- if EOF is encountered mid-row or any invalid data is encountered.
-
readEntry
Description copied from interface:TableReader
Read a record from the source, expecting that not all records will be Row records.
Note: The default implementation delegates to the now-deprecatedTableReader.readRow()
, which cannot handle record entries.- Specified by:
readEntry
in interfaceTableReader
- Returns:
- true if successful, false if EOF or an error is encountered.
- Throws:
IOException
- if EOF is encountered mid-entry or any invalid data is encountered.
-
close
Description copied from interface:TableReader
Close the input source for this TableReader.- Specified by:
close
in interfaceTableReader
- Throws:
IOException
-
getColumnNames
Description copied from interface:TableReader
Get an array of all known column names. These can be used to determine valid column names for use inTableReader.getGetter(String)
.- Specified by:
getColumnNames
in interfaceTableReader
- Returns:
- a new array of all known column names.
-
getColumnType
Description copied from interface:TableReader
Get the SupportedType of the named column.- Specified by:
getColumnType
in interfaceTableReader
- Parameters:
columnName
- the name of the column- Returns:
- the SupportedType value for the named column
-
getFlagGetter
Description copied from interface:TableReader
Retrieve the getter for the row flags.- Specified by:
getFlagGetter
in interfaceTableReader
- Returns:
- a getter that returns the flags for each row.
-
getApplicationVersion
public int getApplicationVersion()Description copied from interface:TableReader
Get the application version associated with the file being read by this TableReader.- Specified by:
getApplicationVersion
in interfaceTableReader
- Returns:
- the file's application version
-
getBinaryStoreFormat
public int getBinaryStoreFormat() -
skipToRecord
- Specified by:
skipToRecord
in interfaceSkipableTableReader
- Throws:
IOException
-
getSize
- Specified by:
getSize
in interfaceSkipableTableReader
- Throws:
IOException
-
setBlocking
public void setBlocking(boolean blocking)Description copied from interface:SkipableTableReader
As implemented, blocking means sleep and retry.- Specified by:
setBlocking
in interfaceSkipableTableReader
-
getTypeMetadataString
Return a string summary of the named column's metadata.- Parameters:
columnName
- the column to query- Returns:
- a summary of the metadata, augmented as possible
-
setRecordHandler
-
setRowHandler
-
getRecordDataGetter
Description copied from interface:TableReader
Retrieve the getter for the RecordData.- Specified by:
getRecordDataGetter
in interfaceTableReader
- Returns:
- a getter that returns the data for the currently read record.
-