com.evelopers.unimod.util
Class DeepCopyHelper

java.lang.Object
  extended bycom.evelopers.unimod.util.DeepCopyHelper

public class DeepCopyHelper
extends java.lang.Object

Object deep copy helper. Utilizes serialization approach.

Do not use in critical application parts due to low performance.


Constructor Summary
DeepCopyHelper()
           
 
Method Summary
static java.lang.Object deepCopy(java.io.Serializable o)
          Creates deep copy of given object.
static java.lang.Object fromByteArray(byte[] buf)
          Deserialize object from given byte array
static byte[] toByteArray(java.io.Serializable o)
          Transform given object into byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeepCopyHelper

public DeepCopyHelper()
Method Detail

toByteArray

public static byte[] toByteArray(java.io.Serializable o)
                          throws java.io.IOException
Transform given object into byte array.

Parameters:
o -
Returns:
Throws:
java.io.IOException

fromByteArray

public static java.lang.Object fromByteArray(byte[] buf)
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException
Deserialize object from given byte array

Parameters:
buf -
Returns:
Throws:
java.io.IOException
java.lang.ClassNotFoundException

deepCopy

public static java.lang.Object deepCopy(java.io.Serializable o)
                                 throws java.lang.ClassNotFoundException,
                                        java.io.IOException
Creates deep copy of given object. Newly creates object has no references to it's originator.

Parameters:
o -
Returns:
Throws:
java.lang.ClassNotFoundException
java.io.IOException