org.infinispan.marshall.jboss
Class JBossMarshaller

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

public class JBossMarshaller
extends Object
implements Marshaller

JBossMarshaller.

Since:
4.0
Author:
Galder ZamarreƱo

Constructor Summary
JBossMarshaller()
           
 
Method Summary
protected  ExternalizerClassFactory createCustomExternalizerFactory(RpcManager rpcManager, CustomObjectTable objectTable)
           
protected  MagicNumberClassTable createMagicNumberClassTable()
           
 void finishObjectInput(ObjectInput oi)
          Finish using the given ObjectInput.
 void finishObjectOutput(ObjectOutput oo)
          Finish using the given ObjectOutput.
 void init(ClassLoader defaultCl, RpcManager rpcManager)
           
 Object objectFromByteBuffer(byte[] buf)
           
 Object objectFromByteBuffer(byte[] buf, int offset, int length)
           
 Object objectFromObjectStream(ObjectInput in)
          Unmarshalls an object from an ObjectInput
 Object objectFromStream(InputStream is)
          Unmarshalls an object from an InputStream
 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)
           
 void objectToObjectStream(Object obj, ObjectOutput out)
          Marshalls an object to a given ObjectOutput
 ObjectInput startObjectInput(InputStream is)
          Create and open a new ObjectInput for the given input stream.
 ObjectOutput startObjectOutput(OutputStream os)
          Create and open a new ObjectOutput for the given output stream.
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossMarshaller

public JBossMarshaller()
Method Detail

init

public void init(ClassLoader defaultCl,
                 RpcManager rpcManager)

stop

public void stop()

objectToByteBuffer

public byte[] objectToByteBuffer(Object obj)
                          throws IOException
Specified by:
objectToByteBuffer in interface Marshaller
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

startObjectOutput

public ObjectOutput startObjectOutput(OutputStream os)
                               throws IOException
Description copied from interface: Marshaller
Create and open a new ObjectOutput for the given output stream. This method should be used for opening data outpus when multiple objectToObjectStream() calls will be made before the stream is closed

Specified by:
startObjectOutput in interface Marshaller
Parameters:
os - output stream
Returns:
ObjectOutput to write to
Throws:
IOException

finishObjectOutput

public void finishObjectOutput(ObjectOutput oo)
Description copied from interface: Marshaller
Finish using the given ObjectOutput. After opening a ObjectOutput and calling objectToObjectStream() mutliple times, use this method to flush the data and close if necessary

Specified by:
finishObjectOutput in interface Marshaller
Parameters:
oo - data output that finished using

objectToObjectStream

public void objectToObjectStream(Object obj,
                                 ObjectOutput out)
                          throws IOException
Description copied from interface: Marshaller
Marshalls an object to a given ObjectOutput

Specified by:
objectToObjectStream in interface Marshaller
Parameters:
obj - object to marshall
out - stream to marshall to
Throws:
IOException

objectFromByteBuffer

public Object objectFromByteBuffer(byte[] buf)
                            throws IOException,
                                   ClassNotFoundException
Specified by:
objectFromByteBuffer in interface Marshaller
Throws:
IOException
ClassNotFoundException

objectFromByteBuffer

public Object objectFromByteBuffer(byte[] buf,
                                   int offset,
                                   int length)
                            throws IOException,
                                   ClassNotFoundException
Specified by:
objectFromByteBuffer in interface Marshaller
Throws:
IOException
ClassNotFoundException

startObjectInput

public ObjectInput startObjectInput(InputStream is)
                             throws IOException
Description copied from interface: Marshaller
Create and open a new ObjectInput for the given input stream. This method should be used for opening data inputs when multiple objectFromObjectStream() calls will be made before the stream is closed.

Specified by:
startObjectInput in interface Marshaller
Parameters:
is - input stream
Returns:
ObjectInput to read from
Throws:
IOException

finishObjectInput

public void finishObjectInput(ObjectInput oi)
Description copied from interface: Marshaller
Finish using the given ObjectInput. After opening a ObjectInput and calling objectFromObjectStream() mutliple times, use this method to flush the data and close if necessary

Specified by:
finishObjectInput in interface Marshaller
Parameters:
oi - data input that finished using

objectFromObjectStream

public Object objectFromObjectStream(ObjectInput in)
                              throws IOException,
                                     ClassNotFoundException
Description copied from interface: Marshaller
Unmarshalls an object from an ObjectInput

Specified by:
objectFromObjectStream in interface Marshaller
Parameters:
in - stream to unmarshall from
Throws:
IOException
ClassNotFoundException

objectFromStream

public Object objectFromStream(InputStream is)
                        throws IOException,
                               ClassNotFoundException
Description copied from interface: Marshaller
Unmarshalls an object from an InputStream

Specified by:
objectFromStream in interface Marshaller
Parameters:
is - stream to unmarshall from
Returns:
Object from stream passed in.
Throws:
IOException
ClassNotFoundException

createMagicNumberClassTable

protected MagicNumberClassTable createMagicNumberClassTable()

createCustomExternalizerFactory

protected ExternalizerClassFactory createCustomExternalizerFactory(RpcManager rpcManager,
                                                                   CustomObjectTable objectTable)


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