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 setConstructor 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)
ISerializer
serialize
in interface ISerializer
object
- the object to serializepublic Object deserialize(byte[] data)
ISerializer
deserialize
in interface ISerializer
data
- 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–2022 Apache Software Foundation. All rights reserved.