Class GraphBinaryReader
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader
-
public class GraphBinaryReader extends Object
Reads a value from a buffer using theTypeSerializerinstances configured in theTypeSerializerRegistry.This class exposes two different methods to read a value from a buffer:
read(Buffer)andreadValue(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
GraphBinaryReadershould be used to read a nested known type from aTypeSerializer. For example, if a POINT type is composed by two doubles representing the position in the x and y axes, aTypeSerializerfor POINT type should use the providedGraphBinaryReaderinstance to read those two double values. As x and y values are expected to be provided as non-nullable doubles, the methodreadValue()should be used:readValue(buffer, Double.class, false)
-
-
Constructor Summary
Constructors Constructor Description GraphBinaryReader()GraphBinaryReader(TypeSerializerRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tread(Buffer buffer)Reads the type code, information and value of a given buffer with fully-qualified format.<T> TreadValue(Buffer buffer, Class<T> type, boolean nullable)Reads a value for an specific type.
-
-
-
Constructor Detail
-
GraphBinaryReader
public GraphBinaryReader()
-
GraphBinaryReader
public GraphBinaryReader(TypeSerializerRegistry registry)
-
-
Method Detail
-
readValue
public <T> T readValue(Buffer buffer, Class<T> type, boolean nullable) throws IOException
Reads a value for an specific type.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.- Throws:
IOException
-
read
public <T> T read(Buffer buffer) throws IOException
Reads the type code, information and value of a given buffer with fully-qualified format.- Throws:
IOException
-
-