aa.util
Class ObjectHandler

java.lang.Object
  extended byaa.util.ObjectHandler

public class ObjectHandler
extends java.lang.Object

This class includes some useful functions to handle an object or objects.

History:

Version:
$Date: 2008/01/01 00:24:06 $ $Revision: 1.1 $
Author:
Myeong-Wuk Jang

Constructor Summary
ObjectHandler()
           
 
Method Summary
static java.lang.Object deepCopy(java.lang.Object p_objOld)
          Makes a deep copy of the specified object.
static java.lang.Object[] deepCopy(java.lang.Object[] p_objaOld)
          Makes a deep copy of the specified array of objects.
static java.lang.Object deserialize(byte[] p_baStream)
          Deserialize a byte stream into an object.
static byte[] serialize(java.io.Serializable p_serObj)
          Serializes an object into a byte stream.
static java.lang.String toStringArgs(java.lang.Object[] p_objaArgs)
          Converts the specified array of objects into a string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectHandler

public ObjectHandler()
Method Detail

deepCopy

public static java.lang.Object deepCopy(java.lang.Object p_objOld)
Makes a deep copy of the specified object.
Reference: http://www.javaworld.com/javatips/jw-javatip76_p.html

Parameters:
p_objOld - an input object to be copied.
Returns:
a new object copied from the given object if the given object is not null;
null if the given object is null.

deepCopy

public static java.lang.Object[] deepCopy(java.lang.Object[] p_objaOld)
Makes a deep copy of the specified array of objects.

Parameters:
p_objaOld - an input array of objects to be copied.
Returns:
a new array of objects copied from the given objects if the given parameter is not null;
null if the given parameter is null.

serialize

public static byte[] serialize(java.io.Serializable p_serObj)
                        throws java.io.IOException
Serializes an object into a byte stream.

Parameters:
p_serObj - the input serializable object.
Returns:
a byte stream corresponding to the specified object.
Throws:
java.io.IOException - any of the usual iput/output exception.

deserialize

public static java.lang.Object deserialize(byte[] p_baStream)
                                    throws java.io.IOException,
                                           java.lang.ClassNotFoundException
Deserialize a byte stream into an object.

Parameters:
p_baStream - the input byte stream of an object of the class.
Returns:
an object corresponding to the specified byte stream.
Throws:
java.io.IOException - any of the usual iput/output exception.
java.lang.ClassNotFoundException - if class of a serialized object cannot be found.

toStringArgs

public static java.lang.String toStringArgs(java.lang.Object[] p_objaArgs)
Converts the specified array of objects into a string representation.

Parameters:
p_objaArgs - an object array to be handled.
Returns:
a string representaiton of the given object array.