Class ThriftCompactReader
java.lang.Object
org.odpi.openmetadata.adapters.connectors.datastore.parquetfile.footer.ThriftCompactReader
ThriftCompactReader decodes a structure that has been serialized using the Apache Thrift compact protocol.
This is the encoding used for all the metadata structures in an Apache Parquet file.
The reader is deliberately generic. It does not know the definition of the structure it is decoding, and so it returns each structure as a map from the field's identifier to its value. The value is one of:
The reader is deliberately generic. It does not know the definition of the structure it is decoding, and so it returns each structure as a map from the field's identifier to its value. The value is one of:
- Boolean - for a boolean field;
- Long - for any of the integer fields (i8, i16, i32, i64);
- Double - for a double field;
- byte[] - for a binary or string field;
- List - for a list or set field;
- Map - for either a nested structure (keyed by field identifier) or a map field.
-
Constructor Summary
ConstructorsConstructorDescriptionThriftCompactReader(byte[] buffer) Create a reader over a buffer of bytes.ThriftCompactReader(byte[] buffer, int offset, int length) Create a reader over part of a buffer of bytes. -
Method Summary
Modifier and TypeMethodDescriptionintReturn the position of the next byte to read.Decode a structure.
-
Constructor Details
-
ThriftCompactReader
public ThriftCompactReader(byte[] buffer) Create a reader over a buffer of bytes.- Parameters:
buffer- bytes to decode
-
ThriftCompactReader
public ThriftCompactReader(byte[] buffer, int offset, int length) Create a reader over part of a buffer of bytes.- Parameters:
buffer- bytes to decodeoffset- position of the first byte to decodelength- number of bytes available to decode
-
-
Method Details
-
getPosition
public int getPosition()Return the position of the next byte to read. After a call to readStruct, this is the first byte after the structure.- Returns:
- offset into the buffer
-
readStruct
Decode a structure.- Returns:
- map of field identifier to field value
- Throws:
IOException- the buffer does not contain a valid structure
-