org.infinispan.marshall.jboss
Class GenericJBossMarshaller

java.lang.Object
  extended by org.infinispan.marshall.jboss.GenericJBossMarshaller
All Implemented Interfaces:
Marshaller
Direct Known Subclasses:
JBossMarshaller

public class GenericJBossMarshaller
extends Object
implements Marshaller

A marshaller that makes use of JBoss Marshalling to serialize and deserialize objects.

In addition to making use of JBoss Marshalling, this Marshaller

Version:
4.1
Author:
Manik Surtani
See Also:
http://www.jboss.org/jbossmarshalling

Nested Class Summary
protected static class GenericJBossMarshaller.DebuggingExceptionListener
           
 
Field Summary
protected  org.jboss.marshalling.MarshallingConfiguration configuration
           
protected static int DEFAULT_BUF_SIZE
           
protected static String DEFAULT_MARSHALLER_FACTORY
           
protected  ClassLoader defaultCl
           
protected  org.jboss.marshalling.MarshallerFactory factory
           
protected static Log log
           
 
Constructor Summary
GenericJBossMarshaller()
           
 
Method Summary
 void finishObjectInput(ObjectInput oi)
           
 void finishObjectOutput(ObjectOutput oo)
           
 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.
 Object objectFromInputStream(InputStream inputStream)
           
 Object objectFromObjectStream(ObjectInput in)
           
 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 o)
          Marshalls an object to a byte array.
 byte[] objectToByteBuffer(Object obj, int estimatedSize)
          Marshalls an object to a byte array.
 void objectToObjectStream(Object obj, ObjectOutput out)
           
 ObjectInput startObjectInput(InputStream is, boolean isReentrant)
           
 ObjectOutput startObjectOutput(OutputStream os, boolean isReentrant)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUF_SIZE

protected static final int DEFAULT_BUF_SIZE
See Also:
Constant Field Values

log

protected static final Log log

DEFAULT_MARSHALLER_FACTORY

protected static final String DEFAULT_MARSHALLER_FACTORY
See Also:
Constant Field Values

defaultCl

protected ClassLoader defaultCl

configuration

protected org.jboss.marshalling.MarshallingConfiguration configuration

factory

protected org.jboss.marshalling.MarshallerFactory factory
Constructor Detail

GenericJBossMarshaller

public GenericJBossMarshaller()
Method Detail

objectToByteBuffer

public byte[] objectToByteBuffer(Object obj,
                                 int estimatedSize)
                          throws IOException
Description copied from interface: Marshaller
Marshalls an object to a byte array. The estimatedSize parameter is a hint that can be passed in to allow for efficient sizing of the byte array before attempting to marshall the object. The more accurate this estimate is, the less likely byte[]s will need to be resized to hold the byte stream generated by marshalling the object.

Specified by:
objectToByteBuffer in interface Marshaller
Parameters:
obj - object to convert to a byte array. Must not be null.
estimatedSize - an estimate of how large the resulting byte array may be
Returns:
a byte array
Throws:
IOException

objectToBuffer

public ByteBuffer objectToBuffer(Object o)
                          throws IOException
Description copied from interface: Marshaller
A method that returns an instance of ByteBuffer, which allows direct access to the byte array with minimal array copying

Specified by:
objectToBuffer in interface Marshaller
Parameters:
o - object to marshall
Returns:
a ByteBuffer
Throws:
IOException

objectToObjectStream

public void objectToObjectStream(Object obj,
                                 ObjectOutput out)
                          throws IOException
Throws:
IOException

startObjectOutput

public ObjectOutput startObjectOutput(OutputStream os,
                                      boolean isReentrant)
                               throws IOException
Throws:
IOException

finishObjectOutput

public void finishObjectOutput(ObjectOutput oo)

objectFromByteBuffer

public Object objectFromByteBuffer(byte[] buf)
                            throws IOException,
                                   ClassNotFoundException
Description copied from interface: Marshaller
Unmarshalls an object from a byte array.

Specified by:
objectFromByteBuffer in interface Marshaller
Parameters:
buf - byte array containing the binary representation of an object. Must not be null.
Returns:
an object
Throws:
IOException
ClassNotFoundException

objectFromByteBuffer

public Object objectFromByteBuffer(byte[] buf,
                                   int offset,
                                   int length)
                            throws IOException,
                                   ClassNotFoundException
Description copied from interface: Marshaller
Unmarshalls an object from a specific portion of a byte array.

Specified by:
objectFromByteBuffer in interface Marshaller
Parameters:
buf - byte array containing the binary representation of an object. Must not be null.
offset - point in buffer to start reading
length - number of bytes to consider
Returns:
an object
Throws:
IOException
ClassNotFoundException

startObjectInput

public ObjectInput startObjectInput(InputStream is,
                                    boolean isReentrant)
                             throws IOException
Throws:
IOException

objectFromObjectStream

public Object objectFromObjectStream(ObjectInput in)
                              throws IOException,
                                     ClassNotFoundException
Throws:
IOException
ClassNotFoundException

finishObjectInput

public void finishObjectInput(ObjectInput oi)

objectFromInputStream

public Object objectFromInputStream(InputStream inputStream)
                             throws IOException,
                                    ClassNotFoundException
Throws:
IOException
ClassNotFoundException

objectToByteBuffer

public byte[] objectToByteBuffer(Object o)
                          throws IOException
Description copied from interface: Marshaller
Marshalls an object to a byte array.

Specified by:
objectToByteBuffer in interface Marshaller
Parameters:
o - object to convert to a byte array. Must not be null.
Returns:
a byte array
Throws:
IOException

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.