voldemort.serialization
Class VersionedSerializer<T>

java.lang.Object
  extended by voldemort.serialization.VersionedSerializer<T>
Type Parameters:
T - The Versioned type
All Implemented Interfaces:
Serializer<Versioned<T>>

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

A Serializer that removes the Versioned wrapper and delegates to a user-supplied serializer to deal with the remaining bytes


Constructor Summary
VersionedSerializer(Serializer<T> innerSerializer)
           
 
Method Summary
 Version getVersion(byte[] bytes)
           
 byte[] toBytes(Versioned<T> versioned)
          Construct an array of bytes from the given object
 Versioned<T> toObject(byte[] bytes)
          Create an object from an array of bytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionedSerializer

public VersionedSerializer(Serializer<T> innerSerializer)
Method Detail

toBytes

public byte[] toBytes(Versioned<T> versioned)
Description copied from interface: Serializer
Construct an array of bytes from the given object

Specified by:
toBytes in interface Serializer<Versioned<T>>
Parameters:
versioned - The object
Returns:
The bytes taken from the object

toObject

public Versioned<T> toObject(byte[] bytes)
Description copied from interface: Serializer
Create an object from an array of bytes

Specified by:
toObject in interface Serializer<Versioned<T>>
Parameters:
bytes - An array of bytes with the objects data
Returns:
A java object serialzed from the bytes

getVersion

public Version getVersion(byte[] bytes)


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