Class GraphBinaryWriter

  • public class GraphBinaryWriter
    extends Object
    Writes a value to a buffer using the TypeSerializer instances configured in the TypeSerializerRegistry.

    This class exposes two different methods to write a value to a buffer: write(Object, Buffer) and writeValue(Object, Buffer, boolean):

    • write() method writes the binary representation of the {type_code}{type_info}{value_flag}{value} components.
    • writeValue() method writes the {value_flag}{value} when a value is nullable and only {value} when a value is not nullable.

    • Constructor Detail

      • GraphBinaryWriter

        public GraphBinaryWriter()
    • Method Detail

      • writeValue

        public <T> void writeValue​(T value,
                                   Buffer buffer,
                                   boolean nullable)
                            throws IOException
        Writes a value without including type information.
      • write

        public <T> void write​(T value,
                              Buffer buffer)
                       throws IOException
        Writes an object in fully-qualified format, containing {type_code}{type_info}{value_flag}{value}.
      • writeFullyQualifiedNull

        public <T> void writeFullyQualifiedNull​(Class<T> objectClass,
                                                Buffer buffer,
                                                Object information)
                                         throws IOException
        Represents a null value of a specific type, useful when the parent type contains a type parameter that must be specified.

        Note that for simple types, the provided information will be null.

      • writeValueFlagNull

        public void writeValueFlagNull​(Buffer buffer)
        Writes a single byte representing the null value_flag.
      • writeValueFlagNone

        public void writeValueFlagNone​(Buffer buffer)
        Writes a single byte with value 0, representing an unset value_flag.