public class SerializationHelper
extends java.lang.Object
Provide common functionalities for serialization of object.
This class throws exceptions for invalid null
inputs.
Each method documents its behavior in more detail.
Constructor and Description |
---|
SerializationHelper() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
clone(java.io.Serializable object)
Deep clone a Serializable object using serialization.
|
static java.lang.Object |
deserialize(byte[] objectBytes)
Deserialize an object from a byte array
|
static java.lang.Object |
deserialize(java.io.InputStream inputStream)
Deserialze an object from an InputStream
|
static byte[] |
serialize(java.io.Serializable obj)
Serialize the object to a byte array
|
static void |
serialize(java.io.Serializable obj,
java.io.OutputStream outputStream)
Serialize the object to an OutputStream
|
public static java.lang.Object clone(java.io.Serializable object) throws java.io.IOException, java.lang.ClassNotFoundException
Deep clone a Serializable object using serialization.
the
- serializable objectIOException,
- ClassNotFoundExceptionjava.io.IOException
java.lang.ClassNotFoundException
public static void serialize(java.io.Serializable obj, java.io.OutputStream outputStream) throws java.io.IOException
obj
- the object to serialize to bytesoutputStream
- the stream to write to, can not be nulljava.io.IOException
public static byte[] serialize(java.io.Serializable obj) throws java.io.IOException
obj
- the object to serialize to bytesjava.io.IOException
public static java.lang.Object deserialize(java.io.InputStream inputStream) throws java.io.IOException, java.lang.ClassNotFoundException
inputStream
- the serialized object input stream, must not be nullIOException,
- ClassNotFoundExceptionjava.io.IOException
java.lang.ClassNotFoundException
public static java.lang.Object deserialize(byte[] objectBytes) throws java.io.IOException, java.lang.ClassNotFoundException
objectBytes
- the serialized object, can not be nullIOException,
- ClassNotFoundExceptionjava.io.IOException
java.lang.ClassNotFoundException
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference