|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
T - the type of the instances to serializepublic interface Serializer<T>
Defines the contract used to transform type instances to and from a serial form.
Implementations must be thread-safe.
When used within the default serialization provider, there are additional requirements. The implementations must define either or both of the two constructors:
Serializer(ClassLoader loader)
Serializer(ClassLoader loader, org.ehcache.spi.persistence.StateRepository stateRepository)
ClassLoader value may be null. If not null, the class loader
instance provided should be used during deserialization to load classes needed by the deserialized objects.
The serialized object's class must be preserved; deserialization of the serial form of an object must return an object of the same class. The following contract must always be true:
object.getClass().equals( mySerializer.read(mySerializer.serialize(object)).getClass() )
SerializationProvider| Method Summary | |
|---|---|
boolean |
equals(T object,
java.nio.ByteBuffer binary)
Checks if the given instance and serial form represent the same instance. |
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. |
| Method Detail |
|---|
java.nio.ByteBuffer serialize(T object)
throws SerializerException
object - the instance to serialize
SerializerException - if serialization fails
T read(java.nio.ByteBuffer binary)
throws java.lang.ClassNotFoundException,
SerializerException
binary - the binary representation of the serial form
SerializerException - if reading the byte buffer fails
java.lang.ClassNotFoundException - if the type to de-serialize to cannot be found
boolean equals(T object,
java.nio.ByteBuffer binary)
throws java.lang.ClassNotFoundException,
SerializerException
represent the same instance.
object - the instance to checkbinary - the serial form to check
true if both parameters represent equal instances, false otherwise
SerializerException - if reading the byte buffer fails
java.lang.ClassNotFoundException - if the type to de-serialize to cannot be found
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||