CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.io
Class SimpleSerializer

java.lang.Object
  extended by com.tangosol.io.SimpleSerializer
All Implemented Interfaces:
ClassLoaderAware, Serializer
Direct Known Subclasses:
SimplePofContext

public class SimpleSerializer
extends Object
implements Serializer, ClassLoaderAware

A Serializer implementation that uses the ExternalizableHelper implementation for serialization and deserialization of objects.

Since:
Coherence 3.2
Author:
cp/jh 2006.07.21

Constructor Summary
SimpleSerializer()
          Default constructor.
SimpleSerializer(ClassLoader loader)
          Construct a SimpleSerializer that will use the passed ClassLoader.
 
Method Summary
 Object deserialize(ReadBuffer.BufferInput in)
          Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.
 ClassLoader getContextClassLoader()
          Retrieve the context ClassLoader for this object.
 void serialize(WriteBuffer.BufferOutput out, Object o)
          Serialize an object to a WriteBuffer by writing its state using the specified BufferOutput object.
 void setContextClassLoader(ClassLoader loader)
          Specify the context ClassLoader for this object.
 

Constructor Detail

SimpleSerializer

public SimpleSerializer()
Default constructor.


SimpleSerializer

public SimpleSerializer(ClassLoader loader)
Construct a SimpleSerializer that will use the passed ClassLoader.

Parameters:
loader - the ClassLoader to use for deserialization
Method Detail

serialize

public void serialize(WriteBuffer.BufferOutput out,
                      Object o)
               throws IOException
Serialize an object to a WriteBuffer by writing its state using the specified BufferOutput object.

Specified by:
serialize in interface Serializer
Parameters:
out - the BufferOutput with which to write the object's state
o - the object to serialize
Throws:
IOException - if an I/O error occurs

deserialize

public Object deserialize(ReadBuffer.BufferInput in)
                   throws IOException
Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.

Specified by:
deserialize in interface Serializer
Parameters:
in - the BufferInput with which to read the object's state
Returns:
the deserialized user type instance
Throws:
IOException - if an I/O error occurs

getContextClassLoader

public ClassLoader getContextClassLoader()
Retrieve the context ClassLoader for this object. The context ClassLoader is provided by the creator of the object for use by the object when loading classes and resources.

Specified by:
getContextClassLoader in interface ClassLoaderAware
Returns:
the context ClassLoader for this object
See Also:
Thread.getContextClassLoader()

setContextClassLoader

public void setContextClassLoader(ClassLoader loader)
Specify the context ClassLoader for this object. The context ClassLoader can be set when the object is created, and allows the creator to provide the appropriate class loader to be used by the object when when loading classes and resources.

Specified by:
setContextClassLoader in interface ClassLoaderAware
Parameters:
loader - the context ClassLoader for this object

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation