public class GraphBinaryReader extends Object
TypeSerializer
instances configured in the
TypeSerializerRegistry
.
This class exposes two different methods to read a value from a buffer: read(Buffer)
and readValue(Buffer, Class, boolean)
:
read()
method expects a value in fully-qualified format, composed of
{type_code}{type_info}{value_flag}{value}
.readValue()
method expects a {value_flag}{value}
when a value is nullable and
only {value}
when a value is not nullable.
The GraphBinaryReader
should be used to read a nested known type from a TypeSerializer
.
For example, if a POINT type is composed by two doubles representing the position in the x and y axes, a
TypeSerializer
for POINT type should use the provided GraphBinaryReader
instance to read those
two double values. As x and y values are expected to be provided as non-nullable doubles, the method
readValue()
should be used: readValue(buffer, Double.class, false)
Constructor and Description |
---|
GraphBinaryReader() |
GraphBinaryReader(TypeSerializerRegistry registry) |
Modifier and Type | Method and Description |
---|---|
<T> T |
read(Buffer buffer)
Reads the type code, information and value of a given buffer with fully-qualified format.
|
<T> T |
readValue(Buffer buffer,
Class<T> type,
boolean nullable)
Reads a value for an specific type.
|
public GraphBinaryReader()
public GraphBinaryReader(TypeSerializerRegistry registry)
public <T> T readValue(Buffer buffer, Class<T> type, boolean nullable) throws IOException
When the value is nullable, the reader expects the {value_flag}{value}
to be contained in the
buffer.
When the value is not nullable, the reader expects only the {value}
to be contained in the
buffer.
IOException
public <T> T read(Buffer buffer) throws IOException
IOException
Copyright © 2013–2022 Apache Software Foundation. All rights reserved.