org.ofbiz.base.util
Class UtilObject

java.lang.Object
  extended by org.ofbiz.base.util.UtilObject

public class UtilObject
extends java.lang.Object

UtilObject


Field Summary
static java.lang.String module
           
 
Constructor Summary
UtilObject()
           
 
Method Summary
static
<T> int
compareToHelper(java.lang.Comparable<T> o1, T o2)
           
static int doHashCode(java.lang.Object o1)
           
static boolean equalsHelper(java.lang.Object o1, java.lang.Object o2)
           
static long getByteCount(java.lang.Object obj)
          Returns the size of a serializable object.
static byte[] getBytes(java.io.InputStream is)
           
static byte[] getBytes(java.lang.Object obj)
          Serialize an object to a byte array
static java.lang.Object getObject(byte[] bytes)
          Deserialize a byte array back to an object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module
Constructor Detail

UtilObject

public UtilObject()
Method Detail

getBytes

public static byte[] getBytes(java.io.InputStream is)

getBytes

public static byte[] getBytes(java.lang.Object obj)
Serialize an object to a byte array


getByteCount

public static long getByteCount(java.lang.Object obj)
                         throws java.io.IOException
Returns the size of a serializable object. Non-serializable objects will throw an IOException.

It is important to note that the returned value is length of the byte stream after the object has been serialized. The returned value does not represent the amount of memory the object uses. There is no accurate way to determine the size of an object in memory.

Parameters:
obj -
Returns:
the number of bytes in the serialized object
Throws:
java.io.IOException

getObject

public static java.lang.Object getObject(byte[] bytes)
Deserialize a byte array back to an object


equalsHelper

public static boolean equalsHelper(java.lang.Object o1,
                                   java.lang.Object o2)

compareToHelper

public static <T> int compareToHelper(java.lang.Comparable<T> o1,
                                      T o2)

doHashCode

public static int doHashCode(java.lang.Object o1)