public interface Serializer
Serializer implementations should implement the ClassLoaderAware interface if they need access to a ClassLoader. However, to support hot-deploying containers, it is important that a Serializer not hold any strong references to that ClassLoader, or to any Class objects obtained from that ClassLoader.
Note: it is extremely important that objects that are equivalent according to their "equals()" implementation produce equivalent serialized streams. Violating this relationship will result in non-deterministic behavior for many Coherence services.
ReadBuffer
,
WriteBuffer
Modifier and Type | Method and Description |
---|---|
default Object |
deserialize(ReadBuffer.BufferInput in)
Deserialize an object from a ReadBuffer by reading its state using the
specified BufferInput object.
|
default <T> T |
deserialize(ReadBuffer.BufferInput in,
Class<? extends T> clazz)
Deserialize an object as an instance of the specified class by reading
its state using the specified BufferInput object.
|
default String |
getName()
Return the name of this serializer.
|
void |
serialize(WriteBuffer.BufferOutput out,
Object o)
Serialize an object to a WriteBuffer by writing its state using the
specified BufferOutput object.
|
void serialize(WriteBuffer.BufferOutput out, Object o) throws IOException
Note: Starting with Coherence 12.2.1 classes that need to designate
an alternative object to be used by the Serializer when writing the object
to the buffer should implement the SerializationSupport.writeReplace()
method.
out
- the BufferOutput with which to write the object's stateo
- the object to serializeIOException
- if an I/O error occursdefault Object deserialize(ReadBuffer.BufferInput in) throws IOException
Note: Starting with Coherence 12.2.1 classes that need to designate
an alternative object to be returned by the Serializer after an object is
deserialized from the buffer should implement the
SerializationSupport.readResolve()
method.
in
- the BufferInput with which to read the object's stateIOException
- if an I/O error occursdefault <T> T deserialize(ReadBuffer.BufferInput in, Class<? extends T> clazz) throws IOException
Note: Starting with Coherence 12.2.1 classes that need to designate
an alternative object to be returned by the Serializer after an object is
deserialized from the buffer should implement the
SerializationSupport.readResolve()
method.
T
- the class to deserialize toin
- the BufferInput with which to read the object's stateclazz
- the type of the object to deserializeIOException
- if an I/O error occursdefault String getName()