Class GraphBinaryReader

  • public class GraphBinaryReader
    extends Object
    Reads a value from a buffer using the 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 Detail

      • GraphBinaryReader

        public GraphBinaryReader()
    • 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.

      • read

        public <T> T read​(Buffer buffer)
                   throws IOException
        Reads the type code, information and value of a given buffer with fully-qualified format.