com.pow2.util
Class Serializer

java.lang.Object
  extended bycom.pow2.util.Serializer

public class Serializer
extends Object

Utility class used to serialize Java objects.

Author:
Dave Miller, Luca Fossato

Method Summary
static Object deepCopy(Object oldObj)
          Return a deep copy of an object
static byte[] toByteArray(Object obj)
          Serialize the input Java object and return its byte stream representation.
static Object toObject(byte[] buf)
          Get a Java Object from its input byte stream representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toObject

public static Object toObject(byte[] buf)
                       throws Exception
Get a Java Object from its input byte stream representation.

Parameters:
buf - the Java object byte stream representation
Returns:
a Java Object retrieved from the input byte stream
Throws:
Exception - Description of the Exception

toByteArray

public static byte[] toByteArray(Object obj)
                          throws Exception
Serialize the input Java object and return its byte stream representation.

Parameters:
obj - the input Java object to serialize
Returns:
the byte stream representing the serialized Java object
Throws:
Exception - Description of the Exception

deepCopy

public static Object deepCopy(Object oldObj)
                       throws Exception
Return a deep copy of an object

Parameters:
oldObj - the object to copy.
Returns:
the object that's the deep-copy of the input one.
Throws:
Exception - Description of the Exception


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.