The SerializationContext allows Objects and object graphs to be written to a ByteBuffer in serialized form.
The function of the context is to keep track of objects and class data that have already been serialized, replacing previously seen objects with simple references. This allows, for instance, the serialization of objects graphs that contains cycles.
Only objects that implement java.io.Serializable
can be serialized through a SerializationContext. Currently, custom serialization (through java.io.Externalizable
or writeObject
method) as well as other advanced serialization features are not supported.
Objects written to a ByteBuffer by a SerializationContext can be retrieved with a DeserializationContext. The data written to the ByteBuffer is not self-contained, because it may refer to objects or classes that have been previously written. Because of that, data written with a single SerializationContext should be read by a single DeserializationContext.
@author Leonardo "Bubble" Mesquita
@see java.nio.ByteBuffer
@see java.io.Serializable
@see com.bubble.serializer.DeserializationContext