edu.jhu.tmaj.util
Class ByteUtil

java.lang.Object
  extended by edu.jhu.tmaj.util.ByteUtil

public final class ByteUtil
extends java.lang.Object

Provides methods for converting byte arrays to objects, and objects to byte arrays


Constructor Summary
ByteUtil()
           
 
Method Summary
static java.lang.Object convertBytesToObject(byte[] bytes)
           
static java.lang.Object convertBytesToObject(byte[] bytes, boolean isObjectCompressed)
           
static byte[] convertObjectToBytes(java.lang.Object obj)
           
static byte[] convertObjectToBytes(java.lang.Object obj, boolean useCompression)
           
static int getCompressedObjectSize(java.lang.Object object)
           
static int getUncompressedObjectSize(java.lang.Object object)
           
static byte[] readByteArrayFromFile(java.io.File file)
           
static void writeByteArrayToFile(java.io.File file, byte[] bytes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteUtil

public ByteUtil()
Method Detail

convertBytesToObject

public static java.lang.Object convertBytesToObject(byte[] bytes)
                                             throws java.io.IOException,
                                                    java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

convertObjectToBytes

public static byte[] convertObjectToBytes(java.lang.Object obj)
                                   throws java.io.IOException
Throws:
java.io.IOException

convertBytesToObject

public static java.lang.Object convertBytesToObject(byte[] bytes,
                                                    boolean isObjectCompressed)
                                             throws java.io.IOException,
                                                    java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

convertObjectToBytes

public static byte[] convertObjectToBytes(java.lang.Object obj,
                                          boolean useCompression)
                                   throws java.io.IOException
Throws:
java.io.IOException

getCompressedObjectSize

public static int getCompressedObjectSize(java.lang.Object object)
                                   throws java.io.IOException
Throws:
java.io.IOException

getUncompressedObjectSize

public static int getUncompressedObjectSize(java.lang.Object object)
                                     throws java.io.IOException
Throws:
java.io.IOException

writeByteArrayToFile

public static void writeByteArrayToFile(java.io.File file,
                                        byte[] bytes)
                                 throws java.io.IOException
Throws:
java.io.IOException

readByteArrayFromFile

public static byte[] readByteArrayFromFile(java.io.File file)
                                    throws java.io.IOException
Throws:
java.io.IOException