Methods Summary |
---|
public static java.lang.Object | clone(java.io.Serializable object)Deep clone a Serializable object using serialization.
return deserialize(serialize(object));
|
public static java.lang.Object | deserialize(java.io.InputStream inputStream)Deserialze an object from an InputStream
if (inputStream == null) {
throw new IllegalArgumentException("The inputStream argument cannot be null");
}
ObjectInputStream inStream = null;
try {
// stream closed in the finally
inStream = new ObjectInputStream(inputStream);
return inStream.readObject();
} finally {
try {
if (inStream != null) {
inStream.close();
}
} catch (IOException ex) {
// ignore
}
}
|
public static java.lang.Object | deserialize(byte[] objectBytes)Deserialize an object from a byte array
if (objectBytes == null) {
throw ValidationException.invalidNullMethodArguments();
}
ByteArrayInputStream inStream = new ByteArrayInputStream(objectBytes);
return deserialize(inStream);
|
public static void | serialize(java.io.Serializable obj, java.io.OutputStream outputStream)Serialize the object to an OutputStream
if (outputStream == null) {
throw ValidationException.invalidNullMethodArguments();
}
ObjectOutputStream outStream = null;
try {
// stream closed in the finally
outStream = new ObjectOutputStream(outputStream);
outStream.writeObject(obj);
} finally {
try {
if (outStream != null) {
outStream.close();
}
} catch (IOException ex) {
// ignore;
}
}
|
public static byte[] | serialize(java.io.Serializable obj)Serialize the object to a byte array
ByteArrayOutputStream outStream = new ByteArrayOutputStream(512);
serialize(obj, outStream);
return outStream.toByteArray();
|