public CustomSerializationScheme
Implement this interface to add your own Serialization Scheme. This is an experimental feature. All methods in this class MUST be thread safe i.e. methods from the same instance of this class can be called in different threads simultaneously.
int getSchemeId()
This method must return an id used to uniquely identify the Scheme. This should be unique within a network as serialized data might be sent over the wire.
@NotNull <T> T deserialize(@NotNull ByteSequence bytes, @NotNull java.lang.Class<T> clazz, @NotNull SerializationSchemeContext context)
This method must deserialize the data stored bytes
into an instance of T.
bytes
- the serialized data.clazz
- the class to instantiate.context
- used to pass information about how the object should be deserialized.bytes
@NotNull <T> ByteSequence serialize(@NotNull T obj, @NotNull SerializationSchemeContext context)
This method must be able to serialize any object T into a ByteSequence.
obj
- the object to be serialized.context
- used to pass information about how the object should be serialized.