public interface SerializationService
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.
Modifier and Type | Method and Description |
---|---|
DeserializationContext |
createDeserializationContext()
Creates a deserialization context that uses all globally registered
DeserializationObjectResolver and DeserializationClassProvider ,
and which allows additional customizations. |
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 . |
java.io.ObjectOutputStream |
createObjectOutputStream(java.io.OutputStream output)
Create a stream for serializing objects using a default context, which
uses all registered
SerializationObjectReplacer . |
SerializationContext |
createSerializationContext()
Creates a serialization context that uses all globally registered
SerializationObjectReplacer ,
and which allows additional customizations. |
java.lang.Object |
replaceObjectForSerialization(java.lang.Object object)
Attempt to return an object appropriate for serialization.
|
java.lang.Object |
resolveObject(java.lang.Object object)
Resolve an object returned by replaceObjectForSerialization.
|
java.lang.Object |
resolveObjectWithException(java.lang.Object object)
Resolve an object returned by replaceObjectForSerialization.
|
SerializationContext createSerializationContext()
SerializationObjectReplacer
,
and which allows additional customizations.java.io.ObjectOutputStream createObjectOutputStream(java.io.OutputStream output) throws java.io.IOException
SerializationObjectReplacer
.output
- the output stream to write serialized object datajava.io.IOException
- if the ObjectOutputStream
constructor throws
an exceptionDeserializationContext createDeserializationContext()
DeserializationObjectResolver
and DeserializationClassProvider
,
and which allows additional customizations.java.io.ObjectInputStream createObjectInputStream(java.io.InputStream input, java.lang.ClassLoader classLoader) throws java.io.IOException
DeserializationClassProvider
and DeserializationObjectReplacer
.
When deserializing application objects, the specified class loader is
typically the thread context class loader.input
- the input stream containing serialized object dataclassLoader
- the class loader for resolving classesjava.io.IOException
- if the ObjectInputStream
constructor throws
an exceptionjava.lang.Object replaceObjectForSerialization(java.lang.Object object)
object
- an object potentially for serializationresolveObject(java.lang.Object)
java.lang.Object resolveObject(java.lang.Object object)
object
- an object returned by replaceObjectForSerialization(java.lang.Object)
java.lang.RuntimeException
- if an error occurs while resolving the objectjava.lang.Object resolveObjectWithException(java.lang.Object object) throws java.io.IOException
object
- an object returned by replaceObjectForSerialization(java.lang.Object)
java.io.IOException