public class JavaObjectSerializer extends AbstractObjectSerializer
ObjectSerializer
that uses Java's default serialization
mechanism. This means that exceptions will come from serializing objects that do
not implement Serializable
muleContext
Constructor and Description |
---|
JavaObjectSerializer() |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
doDeserialize(InputStream inputStream,
ClassLoader classLoader)
Deserializes the given
inputStream using the provided classLoader . |
protected byte[] |
doSerialize(Object object)
Serializes the given object.
|
protected <T> T |
postInitialize(T object) |
void |
serialize(Object object,
OutputStream out)
Serializes the given object and writes the result into
out |
deserialize, deserialize, deserialize, deserialize, serialize, setMuleContext
public void serialize(Object object, OutputStream out) throws SerializationException
out
serialize
in interface ObjectSerializer
serialize
in class AbstractObjectSerializer
object
- the object to be serialized. Might be null
out
- an OutputStream
where the result will be writtenSerializationException
- in case of unexpected exceptionprotected byte[] doSerialize(Object object) throws Exception
doSerialize
in class AbstractObjectSerializer
object
- the object to be serializedException
- any exception thrown. Base class will handle accordinglyprotected <T> T doDeserialize(InputStream inputStream, ClassLoader classLoader) throws Exception
inputStream
using the provided classLoader
.
No need to worry about error handling or deserialization post initialization. Base class
does all of that automaticallydoDeserialize
in class AbstractObjectSerializer
inputStream
- an open InputStream
, not to be explicitly closed in this methodclassLoader
- a ClassLoader
Exception
protected <T> T postInitialize(T object)
postInitialize
in class AbstractObjectSerializer
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.