Package org.apache.wicket.serialize.java
Class JavaSerializer
- java.lang.Object
-
- org.apache.wicket.serialize.java.JavaSerializer
-
- All Implemented Interfaces:
ISerializer
- Direct Known Subclasses:
DeflatedJavaSerializer
public class JavaSerializer extends Object implements ISerializer
An implementation ofISerializer
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 Summary
Constructors Constructor Description JavaSerializer(String applicationKey)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
deserialize(byte[] data)
Reconstructs the object from its serialized stateprotected ObjectInputStream
newObjectInputStream(InputStream in)
Gets a new instance of anObjectInputStream
with the providedInputStream
.protected ObjectOutputStream
newObjectOutputStream(OutputStream out)
Gets a new instance of anObjectOutputStream
with the providedOutputStream
.byte[]
serialize(Object object)
Converts the object to byte array
-
-
-
Constructor Detail
-
JavaSerializer
public JavaSerializer(String applicationKey)
Construct.- Parameters:
applicationKey
- the name of the application
-
-
Method Detail
-
serialize
public byte[] serialize(Object object)
Description copied from interface:ISerializer
Converts the object to byte array- Specified by:
serialize
in interfaceISerializer
- Parameters:
object
- the object to serialize- Returns:
- the serialized page as byte array
-
deserialize
public Object deserialize(byte[] data)
Description copied from interface:ISerializer
Reconstructs the object from its serialized state- Specified by:
deserialize
in interfaceISerializer
- Parameters:
data
- the serialized state of the object- Returns:
- the object reconstructed from its serialized state
-
newObjectInputStream
protected ObjectInputStream newObjectInputStream(InputStream in) throws IOException
Gets a new instance of anObjectInputStream
with the providedInputStream
.- Parameters:
in
- The input stream that should be used for the reading- Returns:
- a new object input stream instance
- Throws:
IOException
- if an I/O error occurs while reading stream header
-
newObjectOutputStream
protected ObjectOutputStream newObjectOutputStream(OutputStream out) throws IOException
Gets a new instance of anObjectOutputStream
with the providedOutputStream
.- Parameters:
out
- The output stream that should be used for the writing- Returns:
- a new object output stream instance
- Throws:
IOException
- if an I/O error occurs while writing stream header
-
-