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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Objectclone(Serializable object) Deep clone a Serializable object using serialization.static Objectdeserialize(byte[] objectBytes) Deserialize an object from a byte arraystatic Objectdeserialize(InputStream inputStream) Deserialze an object from an InputStreamstatic byte[]serialize(Serializable obj) Serialize the object to a byte arraystatic voidserialize(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:
IOExceptionClassNotFoundException
-
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:
IOExceptionClassNotFoundException
-
deserialize
Deserialize an object from a byte array- Parameters:
objectBytes- the serialized object, can not be null- Returns:
- the deserialized object
- Throws:
IOExceptionClassNotFoundException
-