org.ehcache.internal.serialization
Class JavaSerializer<T>
java.lang.Object
org.ehcache.internal.serialization.JavaSerializer<T>
- All Implemented Interfaces:
- Serializer<T>
public class JavaSerializer<T>
- extends java.lang.Object
- implements Serializer<T>
Method Summary |
boolean |
equals(T object,
java.nio.ByteBuffer binary)
Checks if the given instance and serial form are representations of the same instance. |
T |
read(java.nio.ByteBuffer entry)
Reconstructs an instance from the given serial form. |
java.nio.ByteBuffer |
serialize(T object)
Transforms the given instance into its serial form. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaSerializer
public JavaSerializer(java.lang.ClassLoader classLoader)
serialize
public java.nio.ByteBuffer serialize(T object)
throws java.io.IOException
- Description copied from interface:
Serializer
- Transforms the given instance into its serial form.
- Specified by:
serialize
in interface Serializer<T>
- Parameters:
object
- the instance to serialize
- Returns:
- the binary representation of the serial form
- Throws:
java.io.IOException
- if serialization fails
read
public T read(java.nio.ByteBuffer entry)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Description copied from interface:
Serializer
- Reconstructs an instance from the given serial form.
- Specified by:
read
in interface Serializer<T>
- Parameters:
entry
- the binary representation of the serial form
- Returns:
- the de-serialized instance
- Throws:
java.io.IOException
- if reading the byte buffer fails
java.lang.ClassNotFoundException
- if the type to de-serialize to cannot be found
equals
public boolean equals(T object,
java.nio.ByteBuffer binary)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Description copied from interface:
Serializer
- Checks if the given instance and serial form are representations of the same instance.
- Specified by:
equals
in interface Serializer<T>
- Parameters:
object
- the instance to checkbinary
- the serial form to check
- Returns:
true
if both parameters represent the same instance, false
otherwise
- Throws:
java.io.IOException
- if reading the byte buffer fails
java.lang.ClassNotFoundException
- if the type to de-serialize to cannot be found