public class CompactJavaSerializer<T> extends java.lang.Object implements StatefulSerializer<T>
Class descriptors in the resultant bytes are encoded as integers. Mappings
between the integer representation and the ObjectStreamClass, and the
Class and the integer representation are stored in a single on-heap
map.
| Constructor and Description |
|---|
CompactJavaSerializer(java.lang.ClassLoader loader)
Constructor to enable this serializer as a transient one.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> java.lang.Class<? extends Serializer<T>> |
asTypedSerializer() |
boolean |
equals(T object,
java.nio.ByteBuffer binary)
Checks if the given instance and serial form
represent the same instance. |
void |
init(StateRepository stateRepository)
This method is used to inject a
StateRepository to the serializer
by the authoritative tier of a cache during the cache initialization. |
T |
read(java.nio.ByteBuffer binary)
Reconstructs an instance from the given serial form.
|
java.nio.ByteBuffer |
serialize(T object)
Transforms the given instance into its serial form.
|
public CompactJavaSerializer(java.lang.ClassLoader loader)
loader - the classloader to useSerializerpublic static <T> java.lang.Class<? extends Serializer<T>> asTypedSerializer()
public void init(StateRepository stateRepository)
StatefulSerializerStateRepository to the serializer
by the authoritative tier of a cache during the cache initialization.
The passed in state repository will have the persistent properties of the injecting tier.init in interface StatefulSerializer<T>stateRepository - the state repositorypublic java.nio.ByteBuffer serialize(T object) throws SerializerException
serialize in interface Serializer<T>object - the instance to serializeSerializerException - if serialization failspublic T read(java.nio.ByteBuffer binary) throws java.lang.ClassNotFoundException, SerializerException
read in interface Serializer<T>binary - the binary representation of the serial formjava.lang.ClassNotFoundException - if the type to de-serialize to cannot be foundSerializerException - if reading the byte buffer failspublic boolean equals(T object, java.nio.ByteBuffer binary) throws java.lang.ClassNotFoundException, SerializerException
represent the same instance.equals in interface Serializer<T>object - the instance to checkbinary - the serial form to checktrue if both parameters represent equal instances, false otherwisejava.lang.ClassNotFoundException - if the type to de-serialize to cannot be foundSerializerException - if reading the byte buffer fails