com.bigdata.io
Class SerializerUtil

java.lang.Object
  extended by com.bigdata.io.SerializerUtil

public class SerializerUtil
extends Object

Helper utilities for (de-)serialization of Serializable objects using the Java serialization mechanisms.

Version:
$Id: SerializerUtil.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
static IRecordSerializer RECORDS
          An IRecordSerializer wrapper for the static methods declared by the SerializerUtil.
static IStreamSerializer STREAMS
          An IStreamSerializer that uses java default serialization.
 
Constructor Summary
SerializerUtil()
           
 
Method Summary
static Object deserialize(byte[] b)
          De-serialize an object using the Java serialization mechansisms.
static Object deserialize(byte[] b, int off, int len)
          De-serialize an object using the Java serialization mechanisms.
static Object deserialize(ByteBuffer buf)
          De-serialize an object using the Java serialization mechansisms.
static Object deserialize(InputStream is)
          De-serialize an object using the Java serialization mechansisms.
static byte[] serialize(Object obj)
          Serialize an object using the Java serialization mechansims.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAMS

public static final IStreamSerializer STREAMS
An IStreamSerializer that uses java default serialization.


RECORDS

public static final IRecordSerializer RECORDS
An IRecordSerializer wrapper for the static methods declared by the SerializerUtil.

Constructor Detail

SerializerUtil

public SerializerUtil()
Method Detail

serialize

public static final byte[] serialize(Object obj)
Serialize an object using the Java serialization mechansims.

Parameters:
obj - A Serializable object.
Returns:
The serialized object state.

deserialize

public static final Object deserialize(byte[] b)
De-serialize an object using the Java serialization mechansisms.

Parameters:
b - A byte[] containing a serialized object.
Returns:
The de-serialized object -or- null iff the byte[] reference is null.

deserialize

public static final Object deserialize(byte[] b,
                                       int off,
                                       int len)
De-serialize an object using the Java serialization mechanisms.

Parameters:
b - A byte[] containing a serialized object.
off - The offset of the first byte to de-serialize.
len - The #of bytes in the object record.
Returns:
The de-serialized object.

deserialize

public static final Object deserialize(InputStream is)
De-serialize an object using the Java serialization mechansisms.

Parameters:
is - The input stream from which to read the serialized data.
Returns:
The de-serialized object.

deserialize

public static final Object deserialize(ByteBuffer buf)
De-serialize an object using the Java serialization mechansisms.

Parameters:
buf - A buffer containing a serialized object. The bytes from Buffer.position() to Buffer.limit() will be de-serialized and the position will be advanced to the limit.
Returns:
The de-serialized object.


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.