public abstract class AbstractMarshaller extends Object implements Marshaller
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_BUF_SIZE |
Constructor and Description |
---|
AbstractMarshaller() |
Modifier and Type | Method and Description |
---|---|
Object |
objectFromByteBuffer(byte[] buf)
Unmarshalls an object from a byte array.
|
Object |
objectFromInputStream(InputStream inputStream)
This method implements
StreamingMarshaller.objectFromInputStream(java.io.InputStream) , but its
implementation has been moved here rather that keeping under a class that implements StreamingMarshaller
in order to avoid code duplication. |
ByteBuffer |
objectToBuffer(Object obj)
A method that returns an instance of
ByteBuffer , which allows direct access to the byte
array with minimal array copying |
protected abstract 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. |
byte[] |
objectToByteBuffer(Object o)
Marshalls an object to a byte array.
|
byte[] |
objectToByteBuffer(Object obj,
int estimatedSize)
Marshalls an object to a byte array.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isMarshallable, objectFromByteBuffer
protected static final int DEFAULT_BUF_SIZE
protected abstract ByteBuffer objectToBuffer(Object o, int estimatedSize) throws IOException, InterruptedException
ByteBuffer
which takes
an estimated size as parameter. A ByteBuffer
allows direct access to the byte
array with minimal array copyingo
- object to marshallestimatedSize
- an estimate of how large the resulting byte array may beException
IOException
InterruptedException
public ByteBuffer objectToBuffer(Object obj) throws IOException, InterruptedException
Marshaller
ByteBuffer
, which allows direct access to the byte
array with minimal array copyingobjectToBuffer
in interface Marshaller
obj
- 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 byte[] objectToByteBuffer(Object o) throws IOException, InterruptedException
Marshaller
objectToByteBuffer
in interface Marshaller
o
- 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 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 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 objectFromInputStream(InputStream inputStream) throws IOException, ClassNotFoundException
StreamingMarshaller.objectFromInputStream(java.io.InputStream)
, but its
implementation has been moved here rather that keeping under a class that implements StreamingMarshaller
in order to avoid code duplication.IOException
ClassNotFoundException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.