org.ehcache.impl.serialization
Class CompactPersistentJavaSerializer<T>

java.lang.Object
  extended by org.ehcache.impl.serialization.CompactPersistentJavaSerializer<T>
All Implemented Interfaces:
java.io.Closeable, Serializer<T>

public class CompactPersistentJavaSerializer<T>
extends java.lang.Object
implements Serializer<T>, java.io.Closeable


Constructor Summary
CompactPersistentJavaSerializer(java.lang.ClassLoader classLoader, FileBasedPersistenceContext persistence)
           
 
Method Summary
 void close()
           
 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 binary)
          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
 

Constructor Detail

CompactPersistentJavaSerializer

public CompactPersistentJavaSerializer(java.lang.ClassLoader classLoader,
                                       FileBasedPersistenceContext persistence)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
Method Detail

close

public final void close()
                 throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

serialize

public java.nio.ByteBuffer serialize(T object)
                              throws SerializerException
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:
SerializerException - if serialization fails

read

public T read(java.nio.ByteBuffer binary)
       throws java.lang.ClassNotFoundException,
              SerializerException
Description copied from interface: Serializer
Reconstructs an instance from the given serial form.

Specified by:
read in interface Serializer<T>
Parameters:
binary - the binary representation of the serial form
Returns:
the de-serialized instance
Throws:
java.lang.ClassNotFoundException - if the type to de-serialize to cannot be found
SerializerException - if reading the byte buffer fails

equals

public boolean equals(T object,
                      java.nio.ByteBuffer binary)
               throws java.lang.ClassNotFoundException,
                      SerializerException
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 check
binary - the serial form to check
Returns:
true if both parameters represent the same instance, false otherwise
Throws:
java.lang.ClassNotFoundException - if the type to de-serialize to cannot be found
SerializerException - if reading the byte buffer fails