Package org.hpccsystems.dfs.client
Class BinaryRecordReader
- java.lang.Object
-
- org.hpccsystems.dfs.client.BinaryRecordReader
-
- All Implemented Interfaces:
IRecordReader
public class BinaryRecordReader extends Object implements IRecordReader
Deserializes data from the provided InputStream and constructs records via the provided IRecordBuilder. Data in the InputStream is expected to be in the HPCC Systems binary record format.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CONVERT_EMPTY_STRINGS_TO_NULL
protected boolean
defaultLE
static int
NO_STRING_PROCESSING
protected IRecordBuilder
rootRecordBuilder
static int
TRIM_FIXED_LEN_STRINGS
static int
TRIM_STRINGS
-
Constructor Summary
Constructors Constructor Description BinaryRecordReader(InputStream is)
BinaryRecordReader(InputStream is, long streamPos)
A Binary record reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAvailable()
Returns the number of bytes available to read immediately.Object
getNext()
getNext Produce the next record.int
getStreamMessageCount()
String
getStreamMessages()
long
getStreamPosAfterLastRecord()
boolean
hasNext()
hasNext Are there more records? The first time used will trigger a remote file read.void
initialize(IRecordBuilder rb)
Initialize.void
setIsIndex(boolean isIdx)
Should be set if this record reader is reading an index file.void
setStringProcessingFlags(int flags)
Set string processing flags.void
setUseDecimalForUnsigned8(boolean useDecimal)
Determines if unsigned 8 values should be parsed into BigDecimals to avoid long overflow.
-
-
-
Field Detail
-
rootRecordBuilder
protected IRecordBuilder rootRecordBuilder
-
defaultLE
protected boolean defaultLE
-
NO_STRING_PROCESSING
public static final int NO_STRING_PROCESSING
- See Also:
- Constant Field Values
-
TRIM_STRINGS
public static final int TRIM_STRINGS
- See Also:
- Constant Field Values
-
TRIM_FIXED_LEN_STRINGS
public static final int TRIM_FIXED_LEN_STRINGS
- See Also:
- Constant Field Values
-
CONVERT_EMPTY_STRINGS_TO_NULL
public static final int CONVERT_EMPTY_STRINGS_TO_NULL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BinaryRecordReader
public BinaryRecordReader(InputStream is) throws Exception
- Throws:
Exception
-
BinaryRecordReader
public BinaryRecordReader(InputStream is, long streamPos) throws Exception
A Binary record reader.- Parameters:
is
- the input streamstreamPos
- the position in the stream to start reading at- Throws:
Exception
- the exception
-
-
Method Detail
-
getStreamMessages
public String getStreamMessages()
-
getStreamMessageCount
public int getStreamMessageCount()
-
getStreamPosAfterLastRecord
public long getStreamPosAfterLastRecord()
-
initialize
public void initialize(IRecordBuilder rb) throws Exception
Description copied from interface:IRecordReader
Initialize.- Specified by:
initialize
in interfaceIRecordReader
- Parameters:
rb
- the record builder- Throws:
Exception
- the exception
-
setUseDecimalForUnsigned8
public void setUseDecimalForUnsigned8(boolean useDecimal)
Determines if unsigned 8 values should be parsed into BigDecimals to avoid long overflow.- Parameters:
useDecimal
- use decimal
-
setIsIndex
public void setIsIndex(boolean isIdx)
Should be set if this record reader is reading an index file.- Parameters:
isIdx
- Is this an index file?
-
setStringProcessingFlags
public void setStringProcessingFlags(int flags)
Set string processing flags.- Parameters:
flags
- string processing flags
-
hasNext
public boolean hasNext() throws HpccFileException
Description copied from interface:IRecordReader
hasNext Are there more records? The first time used will trigger a remote file read.- Specified by:
hasNext
in interfaceIRecordReader
- Returns:
- true if there is at least one more record
- Throws:
HpccFileException
- if there was a failure on the back end. This error is not recoverable by a retry.
-
getNext
public Object getNext() throws HpccFileException
Description copied from interface:IRecordReader
getNext Produce the next record.- Specified by:
getNext
in interfaceIRecordReader
- Returns:
- a record
- Throws:
HpccFileException
- error on the back end, not recoverable
-
getAvailable
public int getAvailable() throws IOException
Returns the number of bytes available to read immediately.- Specified by:
getAvailable
in interfaceIRecordReader
- Returns:
- the available
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
-