public final class BCF2Decoder
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
|
BCF2Decoder() |
protected |
BCF2Decoder(byte[] recordBytes)
Create a new decoder ready to read BCF2 data from the byte[] recordBytes, for testing purposes
|
Modifier and Type | Method and Description |
---|---|
boolean |
blockIsFullyDecoded() |
int |
decodeInt(BCF2Type type) |
int |
decodeInt(byte typeDescriptor,
int missingValue)
Decode an int from the stream.
|
int[] |
decodeIntArray(byte typeDescriptor,
int size) |
int[] |
decodeIntArray(int size,
BCF2Type type,
int[] maybeDest)
Low-level reader for int[]
Requires a typeDescriptor so the function knows how many elements to read,
and how they are encoded.
|
int |
decodeNumberOfElements(byte typeDescriptor) |
java.lang.Object |
decodeSingleValue(BCF2Type type) |
java.lang.Object |
decodeTypedValue() |
java.lang.Object |
decodeTypedValue(byte typeDescriptor) |
java.lang.Object |
decodeTypedValue(byte typeDescriptor,
int size) |
int |
getBlockSize()
The size of the current block in bytes
|
byte[] |
getRecordBytes()
Returns the byte[] for the block of data we are currently decoding
|
int |
readBlockSize(java.io.InputStream inputStream)
Read the size of the next block from inputStream
|
void |
readNextBlock(int blockSizeInBytes,
java.io.InputStream stream)
Reads the next record from input stream and prepare this decoder to decode values from it
|
byte |
readTypeDescriptor() |
void |
setRecordBytes(byte[] recordBytes)
Use the recordBytes[] to read BCF2 records from now on
|
void |
skipNextBlock(int blockSizeInBytes,
java.io.InputStream stream)
Skips the next record from input stream, invalidating current block data
|
public BCF2Decoder()
protected BCF2Decoder(byte[] recordBytes)
recordBytes
- public void readNextBlock(int blockSizeInBytes, java.io.InputStream stream)
stream
- public void skipNextBlock(int blockSizeInBytes, java.io.InputStream stream)
stream
- public byte[] getRecordBytes()
public int getBlockSize()
public boolean blockIsFullyDecoded()
public void setRecordBytes(byte[] recordBytes)
recordBytes
- public final java.lang.Object decodeTypedValue() throws java.io.IOException
java.io.IOException
public final java.lang.Object decodeTypedValue(byte typeDescriptor) throws java.io.IOException
java.io.IOException
public final java.lang.Object decodeTypedValue(byte typeDescriptor, int size) throws java.io.IOException
java.io.IOException
public final java.lang.Object decodeSingleValue(BCF2Type type) throws java.io.IOException
java.io.IOException
public final int decodeNumberOfElements(byte typeDescriptor) throws java.io.IOException
java.io.IOException
public final int decodeInt(byte typeDescriptor, int missingValue) throws java.io.IOException
typeDescriptor
- java.io.IOException
public final int decodeInt(BCF2Type type) throws java.io.IOException
java.io.IOException
public final int[] decodeIntArray(int size, BCF2Type type, int[] maybeDest) throws java.io.IOException
maybeDest
- if not null we'll not allocate space for the vector, but instead use
the externally allocated array of ints to store values. If the
size of this vector is < the actual size of the elements, we'll be
forced to use freshly allocated arrays. Also note that padded
int elements are still forced to do a fresh allocation as well.java.io.IOException
public final int[] decodeIntArray(byte typeDescriptor, int size) throws java.io.IOException
java.io.IOException
public final int readBlockSize(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- java.io.IOException
public final byte readTypeDescriptor() throws java.io.IOException
java.io.IOException