voldemort.serialization.avro
Class AvroSpecificSerializer<T extends org.apache.avro.specific.SpecificRecord>

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

public class AvroSpecificSerializer<T extends org.apache.avro.specific.SpecificRecord>
extends java.lang.Object
implements Serializer<T>

Avro serializer that relies on generated Java classes for schemas and protocols.

This API is recommended for most RPC uses and for data applications that always use the same datatypes, i.e., whose schemas are known at compile time. For data applications that accept dynamic datatypes the generic API is recommended.


Constructor Summary
AvroSpecificSerializer(java.lang.String schemaInfo)
          Constructor accepting a Java class name under the convention java=classname.
 
Method Summary
 byte[] toBytes(T object)
          Construct an array of bytes from the given object
 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

AvroSpecificSerializer

public AvroSpecificSerializer(java.lang.String schemaInfo)
Constructor accepting a Java class name under the convention java=classname.

Parameters:
schemaInfo - information on the schema for the serializer.
Method Detail

toBytes

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

Specified by:
toBytes in interface Serializer<T extends org.apache.avro.specific.SpecificRecord>
Parameters:
object - The object
Returns:
The bytes taken from the object

toObject

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

Specified by:
toObject in interface Serializer<T extends org.apache.avro.specific.SpecificRecord>
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