public class HotRodEntryMarshaller extends Object implements Marshaller
Constructor and Description |
---|
HotRodEntryMarshaller(ByteBufferFactory byteBufferFactory) |
Modifier and Type | Method and Description |
---|---|
BufferSizePredictor |
getBufferSizePredictor(Object o)
Returns a marshalled payload size predictor for a particular type.
|
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)
Unmarshalls an object from a byte array.
|
Object |
objectFromByteBuffer(byte[] buf,
int offset,
int length)
Unmarshalls an object from a specific portion of a byte array.
|
ByteBuffer |
objectToBuffer(Object o)
A method that returns an instance of
ByteBuffer , which allows direct access to the byte
array with minimal array copying |
byte[] |
objectToByteBuffer(Object obj)
Marshalls an object to a byte array.
|
byte[] |
objectToByteBuffer(Object obj,
int estimatedSize)
Marshalls an object to a byte array.
|
public HotRodEntryMarshaller(ByteBufferFactory byteBufferFactory)
public byte[] objectToByteBuffer(Object obj, int estimatedSize) throws IOException, InterruptedException
Marshaller
objectToByteBuffer
in interface Marshaller
obj
- object to convert to a byte array. Must not be null.estimatedSize
- an estimate of how large the resulting byte array may beIOException
- if marshalling cannot complete due to some I/O errorInterruptedException
- if the marshalling was interrupted. Clients should take this as a sign that
the marshaller is no longer available, maybe due to shutdown, and so no more unmarshalling should be attempted.public byte[] objectToByteBuffer(Object obj) throws IOException, InterruptedException
Marshaller
objectToByteBuffer
in interface Marshaller
obj
- object to convert to a byte array. Must not be null.IOException
- if marshalling cannot complete due to some I/O errorInterruptedException
- if the marshalling process was interrupted. Clients should take this as a sign that
the marshaller is no longer available, maybe due to shutdown, and so no more marshalling should be attempted.public Object objectFromByteBuffer(byte[] buf) throws IOException, ClassNotFoundException
Marshaller
objectFromByteBuffer
in interface Marshaller
buf
- byte array containing the binary representation of an object. Must not be null.IOException
- if unmarshalling cannot complete due to some I/O errorClassNotFoundException
- if the class of the object trying to unmarshall is unknownpublic Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException
Marshaller
objectFromByteBuffer
in interface Marshaller
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 considerIOException
- if unmarshalling cannot complete due to some I/O errorClassNotFoundException
- if the class of the object trying to unmarshall is unknownpublic ByteBuffer objectToBuffer(Object o) throws IOException, InterruptedException
Marshaller
ByteBuffer
, which allows direct access to the byte
array with minimal array copyingobjectToBuffer
in interface Marshaller
o
- object to marshallIOException
- if marshalling cannot complete due to some I/O errorInterruptedException
- if the marshalling process was interrupted. Clients should take this as a sign that
the marshaller is no longer available, maybe due to shutdown, and so no more marshalling should be attempted.public boolean isMarshallable(Object o) throws Exception
Marshaller
isMarshallable
in interface Marshaller
o
- object to verify whether it's marshallable or notException
- if while checking whether the object was serializable or not, an exception arosepublic BufferSizePredictor getBufferSizePredictor(Object o)
Marshaller
getBufferSizePredictor
in interface Marshaller
o
- Object for which serialized predictor will be returnedBufferSizePredictor
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.