public class JavaSerializer extends Object implements ISerializer
ISerializer based on Java Serialization (ObjectOutputStream,
ObjectInputStream)
Requires the application key to enable serialization and deserialisation outside thread in which
application thread local is set| Constructor and Description |
|---|
JavaSerializer(String applicationKey)
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
deserialize(byte[] data)
Reconstructs the object from its serialized state
|
protected ObjectInputStream |
newObjectInputStream(InputStream in)
Gets a new instance of an
ObjectInputStream with the provided InputStream. |
protected ObjectOutputStream |
newObjectOutputStream(OutputStream out)
Gets a new instance of an
ObjectOutputStream with the provided OutputStream. |
byte[] |
serialize(Object object)
Converts the object to byte array
|
public JavaSerializer(String applicationKey)
applicationKey - the name of the applicationpublic byte[] serialize(Object object)
ISerializerserialize in interface ISerializerobject - the object to serializepublic Object deserialize(byte[] data)
ISerializerdeserialize in interface ISerializerdata - the serialized state of the objectprotected ObjectInputStream newObjectInputStream(InputStream in) throws IOException
ObjectInputStream with the provided InputStream.in - The input stream that should be used for the readingIOException - if an I/O error occurs while reading stream headerprotected ObjectOutputStream newObjectOutputStream(OutputStream out) throws IOException
ObjectOutputStream with the provided OutputStream.out - The output stream that should be used for the writingIOException - if an I/O error occurs while writing stream headerCopyright © 2006–2021 Apache Software Foundation. All rights reserved.