com.ibm.ws.serialization

Interface SerializationService


  1. public interface SerializationService
A service for serializing user objects that can contain references to product internal objects.

As an alternative to this service, if the serialization/deserialization will always happen using an application thread context class loader, then DeserializationObjectInputStream could be used with thread context class loader if the necessary classes are all exported with the thread-context attribute. This approach does not work if an application thread context class loader is not used or if replacers or resolvers are needed.


Method Summary

Modifier and Type Method and Description
  1. DeserializationContext
createDeserializationContext()
Creates a deserialization context that uses all globally registered DeserializationObjectResolver and DeserializationClassProvider, and which allows additional customizations.
  1. java.io.ObjectInputStream
createObjectInputStream(java.io.InputStream input,java.lang.ClassLoader classLoader)
Create a stream for deserializing objects using a default context, which uses all registered DeserializationClassProvider and DeserializationObjectReplacer.
  1. java.io.ObjectOutputStream
createObjectOutputStream(java.io.OutputStream output)
Create a stream for serializing objects using a default context, which uses all registered SerializationObjectReplacer.
  1. SerializationContext
createSerializationContext()
Creates a serialization context that uses all globally registered SerializationObjectReplacer, and which allows additional customizations.
  1. java.lang.Object
replaceObjectForSerialization(java.lang.Object object)
Attempt to return an object appropriate for serialization.
  1. java.lang.Object
resolveObject(java.lang.Object object)
Resolve an object returned by replaceObjectForSerialization.

Method Detail

createSerializationContext

  1. SerializationContext createSerializationContext( )
Creates a serialization context that uses all globally registered SerializationObjectReplacer, and which allows additional customizations.

createObjectOutputStream

  1. java.io.ObjectOutputStream createObjectOutputStream( java.io.OutputStream output)
  2. throws java.io.IOException
Create a stream for serializing objects using a default context, which uses all registered SerializationObjectReplacer.
Parameters:
output - the output stream to write serialized object data
Returns:
a stream for serialization
Throws:
java.io.IOException - if the ObjectOutputStream constructor throws an exception

createDeserializationContext

  1. DeserializationContext createDeserializationContext( )
Creates a deserialization context that uses all globally registered DeserializationObjectResolver and DeserializationClassProvider, and which allows additional customizations.

createObjectInputStream

  1. java.io.ObjectInputStream createObjectInputStream( java.io.InputStream input,
  2. java.lang.ClassLoader classLoader)
  3. throws java.io.IOException
Create a stream for deserializing objects using a default context, which uses all registered DeserializationClassProvider and DeserializationObjectReplacer. When deserializing application objects, the specified class loader is typically the thread context class loader.
Parameters:
input - the input stream containing serialized object data
classLoader - the class loader for resolving classes
Returns:
a stream for deserialization
Throws:
java.io.IOException - if the ObjectInputStream constructor throws an exception

replaceObjectForSerialization

  1. java.lang.Object replaceObjectForSerialization( java.lang.Object object)
Attempt to return an object appropriate for serialization. This can be used by services that need to know whether or not an object can be serialized. If non-null is returned, the object should be passed to ObjectOutputStream.writeObject.
Parameters:
object - an object potentially for serialization
Returns:
an object for serialization, or null if the object cannot be serialized
See Also:

resolveObject

  1. java.lang.Object resolveObject( java.lang.Object object)
Resolve an object returned by replaceObjectForSerialization.
Parameters:
Returns:
a resolved object, or the input object if it does not need to be resolved