voldemort.serialization.avro
Class AvroGenericSerializer

java.lang.Object
  extended by voldemort.serialization.avro.AvroGenericSerializer
All Implemented Interfaces:
Serializer<java.lang.Object>

public class AvroGenericSerializer
extends java.lang.Object
implements Serializer<java.lang.Object>

Avro serializer that uses the generic representation for Avro data. This representation is best for applications which deal with dynamic data, whose schemas are not known until runtime.


Constructor Summary
AvroGenericSerializer(java.lang.String schema)
          Constructor accepting the schema definition as a JSON string.
 
Method Summary
 byte[] toBytes(java.lang.Object object)
          Construct an array of bytes from the given object
 java.lang.Object 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

AvroGenericSerializer

public AvroGenericSerializer(java.lang.String schema)
Constructor accepting the schema definition as a JSON string.

Parameters:
schema - a serialized JSON object representing a Avro schema.
Method Detail

toBytes

public byte[] toBytes(java.lang.Object object)
Description copied from interface: Serializer
Construct an array of bytes from the given object

Specified by:
toBytes in interface Serializer<java.lang.Object>
Parameters:
object - The object
Returns:
The bytes taken from the object

toObject

public java.lang.Object toObject(byte[] bytes)
Description copied from interface: Serializer
Create an object from an array of bytes

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


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