Module org.eclipse.persistence.core
Class SerializationHelper
java.lang.Object
org.eclipse.persistence.internal.helper.SerializationHelper
Provide common functionalities for serialization of object.
This class throws exceptions for invalid null
inputs.
Each method documents its behavior in more detail.
- Since:
- OracleAS 10.0.3
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
clone
(Serializable object) Deep clone a Serializable object using serialization.static Object
deserialize
(byte[] objectBytes) Deserialize an object from a byte arraystatic Object
deserialize
(InputStream inputStream) Deserialze an object from an InputStreamstatic byte[]
serialize
(Serializable obj) Serialize the object to a byte arraystatic void
serialize
(Serializable obj, OutputStream outputStream) Serialize the object to an OutputStream
-
Constructor Details
-
SerializationHelper
public SerializationHelper()
-
-
Method Details
-
clone
Deep clone a Serializable object using serialization.
- Parameters:
object
- the serializable object- Returns:
- the deep cloned object
- Throws:
IOException
ClassNotFoundException
-
serialize
Serialize the object to an OutputStream- Parameters:
obj
- the object to serialize to bytesoutputStream
- the stream to write to, can not be null- Throws:
IOException
-
serialize
Serialize the object to a byte array- Parameters:
obj
- the object to serialize to bytes- Returns:
- a byte[] of the obj
- Throws:
IOException
-
deserialize
public static Object deserialize(InputStream inputStream) throws IOException, ClassNotFoundException Deserialze an object from an InputStream- Parameters:
inputStream
- the serialized object input stream, must not be null- Returns:
- the deserialized object
- Throws:
IOException
ClassNotFoundException
-
deserialize
Deserialize an object from a byte array- Parameters:
objectBytes
- the serialized object, can not be null- Returns:
- the deserialized object
- Throws:
IOException
ClassNotFoundException
-