org.infinispan.client.hotrod.marshall
Class ApacheAvroMarshaller
java.lang.Object
org.infinispan.marshall.AbstractMarshaller
org.infinispan.client.hotrod.marshall.ApacheAvroMarshaller
- All Implemented Interfaces:
- Marshaller
public class ApacheAvroMarshaller
- extends AbstractMarshaller
This is a portable serialization marshaller based on Apache Avro. It supports basic type and collection marshalling.
Basic types include UTF-8 String, int long, float, double, boolean and null, and the collections supported include
arrays, list, map and set composed of basic types.
Primitive types short and byte are not supported per se. Instead, pass integers which will be encoded efficiently
using variable-length (http://lucene.apache.org/java/2_4_0/fileformats.html#VInt) zig zag
(http://code.google.com/apis/protocolbuffers/docs/encoding.html#types) coding.
Primitive arrays not supported except byte arrays. Instead, use their object counter partners, i.e. Integer...etc.
For more detailed information, go to: http://community.jboss.org/docs/DOC-15774
- Since:
- 5.0
- Author:
- Galder ZamarreƱo
Method Summary |
boolean |
isMarshallable(Object o)
A method that checks whether the given object is marshallable as per the rules of this marshaller. |
Object |
objectFromByteBuffer(byte[] buf,
int offset,
int length)
Unmarshalls an object from a specific portion of a byte array. |
protected ByteBuffer |
objectToBuffer(Object o,
int estimatedSize)
This is a convenience method for converting an object into a ByteBuffer which takes
an estimated size as parameter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ApacheAvroMarshaller
public ApacheAvroMarshaller()
objectToBuffer
protected ByteBuffer objectToBuffer(Object o,
int estimatedSize)
throws IOException
- Description copied from class:
AbstractMarshaller
- This is a convenience method for converting an object into a
ByteBuffer
which takes
an estimated size as parameter. A ByteBuffer
allows direct access to the byte
array with minimal array copying
- Specified by:
objectToBuffer
in class AbstractMarshaller
- Parameters:
o
- object to marshallestimatedSize
- an estimate of how large the resulting byte array may be
- Returns:
- a ByteBuffer
- Throws:
IOException
objectFromByteBuffer
public Object objectFromByteBuffer(byte[] buf,
int offset,
int length)
throws IOException
- Description copied from interface:
Marshaller
- Unmarshalls an object from a specific portion of a byte array.
- Parameters:
buf
- byte array containing the binary representation of an object. Must not be null.offset
- point in buffer to start readinglength
- number of bytes to consider
- Returns:
- an object
- Throws:
IOException
- if unmarshalling cannot complete due to some I/O error
isMarshallable
public boolean isMarshallable(Object o)
- Description copied from interface:
Marshaller
- A method that checks whether the given object is marshallable as per the rules of this marshaller.
- Parameters:
o
- object to verify whether it's marshallable or not
- Returns:
- true if the object is marshallable, otherwise false
Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.