public interface SerializationProtocol
bytes. Unlike usual serializing
components, this one doesn't enforce the serialized object to implement Serializable. However, some implementations
might require that condition and throw IllegalArgumentException if not met.
Implementations are also responsible for the correct initialization of classes implementing the
org.mule.runtime.core.util.store.DeserializationPostInitialisable interface.
Unexpected behavior can result of deserializing objects that were generated with a different implementation of
SerializationProtocol.
Implementations are required to be thread-safe| Modifier and Type | Method and Description |
|---|---|
<T> T |
deserialize(byte[] bytes)
Deserializes the given bytes.
|
<T> T |
deserialize(byte[] bytes,
ClassLoader classLoader)
Deserializes the given bytes.
|
<T> T |
deserialize(InputStream inputStream)
Deserializes the given stream of bytes.
|
<T> T |
deserialize(InputStream inputStream,
ClassLoader classLoader)
Deserializes the given stream of bytes.
|
byte[] |
serialize(Object object)
Serializes the given object into a an array of
bytes |
void |
serialize(Object object,
OutputStream out)
Serializes the given object and writes the result into
out |
byte[] serialize(Object object) throws SerializationException
bytesobject - the object to be serialized. Might be nullbyteSerializationException - in case of unexpected exceptionvoid serialize(Object object, OutputStream out) throws SerializationException
outobject - the object to be serialized. Might be nullout - an OutputStream where the result will be writtenSerializationException - in case of unexpected exception<T> T deserialize(byte[] bytes)
throws SerializationException
org.mule.runtime.core.util.store.DeserializationPostInitialisable then this
serializer will be responsible for properly initializing the object before returning it.
Implementation will choose the ClassLoader to use for deserialization.bytes - an array of byte that an original object was serialized intoIllegalArgumentException - if bytes is nullSerializationException - in case of unexpected exception<T> T deserialize(byte[] bytes,
ClassLoader classLoader)
throws SerializationException
org.mule.runtime.core.util.store.DeserializationPostInitialisable then this
serializer will be responsible for properly initializing the object before returning it.bytes - an array of byte that an original object was serialized intoclassLoader - the ClassLoader to deserialize withIllegalArgumentException - if bytes is nullSerializationException - in case of unexpected exception<T> T deserialize(InputStream inputStream) throws SerializationException
ClassLoader to use for deserialization.
Even if deserialization fails, this method will close the inputStream
If the obtained object implements org.mule.runtime.core.util.store.DeserializationPostInitialisable then this
serializer will be responsible for properly initializing the object before returning it.inputStream - a stream of bytes that an original object was serialized intoIllegalArgumentException - if inputStream is nullSerializationException - in case of unexpected exception<T> T deserialize(InputStream inputStream, ClassLoader classLoader) throws SerializationException
inputStream
If the obtained object implements org.mule.runtime.core.util.store.DeserializationPostInitialisable then this
serializer will be responsible for properly initializing the object before returning it.inputStream - a stream of bytes that an original object was serialized intoclassLoader - the ClassLoader to deserialize withIllegalArgumentException - if inputStream is nullSerializationException - in case of unexpected exceptionCopyright © 2017 MuleSoft, Inc.. All rights reserved.