voldemort.serialization
Class ObjectSerializer<T>

java.lang.Object
  extended by voldemort.serialization.ObjectSerializer<T>
Type Parameters:
T - The type of the object
All Implemented Interfaces:
Serializer<T>

public class ObjectSerializer<T>
extends java.lang.Object
implements Serializer<T>

Transform java objects into bytes using java's built in serialization mechanism


Constructor Summary
ObjectSerializer()
           
 
Method Summary
 byte[] toBytes(T object)
          Transform the given object into an array of bytes
 T toObject(byte[] bytes)
          Transform the given bytes into an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectSerializer

public ObjectSerializer()
Method Detail

toBytes

public byte[] toBytes(T object)
Transform the given object into an array of bytes

Specified by:
toBytes in interface Serializer<T>
Parameters:
object - The object to be serialized
Returns:
The bytes created from serializing the object

toObject

public T toObject(byte[] bytes)
Transform the given bytes into an object.

Specified by:
toObject in interface Serializer<T>
Parameters:
bytes - The bytes to construct the object from
Returns:
The object constructed


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu