public class GraphBinaryWriter extends Object
TypeSerializer
instances configured in the
TypeSerializerRegistry
.
This class exposes two different methods to write a value to a buffer:
write(Object, ByteBuf)
and
writeValue(Object, ByteBuf, 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.
Modifier and Type | Field and Description |
---|---|
static byte |
VERSION_BYTE |
Constructor and Description |
---|
GraphBinaryWriter() |
GraphBinaryWriter(TypeSerializerRegistry registry) |
Modifier and Type | Method and Description |
---|---|
<T> void |
write(T value,
ByteBuf buffer)
Writes an object in fully-qualified format, containing {type_code}{type_info}{value_flag}{value}.
|
<T> void |
writeFullyQualifiedNull(Class<T> objectClass,
ByteBuf buffer,
Object information)
Represents a null value of a specific type, useful when the parent type contains a type parameter that must be
specified.
|
<T> void |
writeValue(T value,
ByteBuf buffer,
boolean nullable)
Writes a value without including type information.
|
void |
writeValueFlagNone(ByteBuf buffer)
Writes a single byte with value 0, representing an unset value_flag.
|
void |
writeValueFlagNull(ByteBuf buffer)
Writes a single byte representing the null value_flag.
|
public static final byte VERSION_BYTE
public GraphBinaryWriter()
public GraphBinaryWriter(TypeSerializerRegistry registry)
public <T> void writeValue(T value, ByteBuf buffer, boolean nullable) throws SerializationException
SerializationException
public <T> void write(T value, ByteBuf buffer) throws SerializationException
SerializationException
public <T> void writeFullyQualifiedNull(Class<T> objectClass, ByteBuf buffer, Object information) throws SerializationException
Note that for simple types, the provided information will be null
.
SerializationException
public void writeValueFlagNull(ByteBuf buffer)
public void writeValueFlagNone(ByteBuf buffer)
Copyright © 2013–2019 Apache Software Foundation. All rights reserved.