Package com.tangosol.io
Class DefaultSerializer
- java.lang.Object
-
- com.tangosol.io.DefaultSerializer
-
- All Implemented Interfaces:
ClassLoaderAware
,Serializer
@Named("java") public final class DefaultSerializer extends Object implements Serializer, ClassLoaderAware
A Serializer implementation that uses the ExternalizableHelper implementation for serialization and deserialization of objects.- Since:
- Coherence 3.4
- Author:
- cp/jh 2006.07.21 (SimpleSerializer)
-
-
Constructor Summary
Constructors Constructor Description DefaultSerializer()
Default constructor.DefaultSerializer(ClassLoader loader)
Construct a DefaultSerializer that will use the passed ClassLoader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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
setContextClassLoader(ClassLoader loader)
Specify the context ClassLoader for this object.String
toString()
Return a description of this DefaultSerializer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tangosol.io.Serializer
deserialize
-
-
-
-
Field Detail
-
NAME
public static final String NAME
The name of this serializer.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultSerializer
public DefaultSerializer()
Default constructor.
-
DefaultSerializer
public DefaultSerializer(ClassLoader loader)
Construct a DefaultSerializer 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
Description copied from interface:Serializer
Serialize an object to a WriteBuffer by writing its state using the specified BufferOutput object.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.- Specified by:
serialize
in interfaceSerializer
- Parameters:
out
- the BufferOutput with which to write the object's stateo
- the object to serialize- Throws:
IOException
- if an I/O error occurs
-
deserialize
public Object deserialize(ReadBuffer.BufferInput in) throws IOException
Description copied from interface:Serializer
Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.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.- Specified by:
deserialize
in interfaceSerializer
- 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
-
getName
public String getName()
Description copied from interface:Serializer
Return the name of this serializer.- Specified by:
getName
in interfaceSerializer
- Returns:
- the name of this serializer
-
getContextClassLoader
public ClassLoader getContextClassLoader()
Description copied from interface:ClassLoaderAware
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 interfaceClassLoaderAware
- Returns:
- the context ClassLoader for this object
- See Also:
Thread.getContextClassLoader()
-
setContextClassLoader
public void setContextClassLoader(ClassLoader loader)
Description copied from interface:ClassLoaderAware
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 interfaceClassLoaderAware
- Parameters:
loader
- the context ClassLoader for this object
-
-