org.ow2.jonas.lib.ejb21
Class MarshallTool

java.lang.Object
  extended by org.ow2.jonas.lib.ejb21.MarshallTool

public class MarshallTool
extends Object

Contains static methods to marshall/unmarshall objects to/from a byte[]

Author:
Vincent Trussart (vincent@linuxfreak.com) : Initial developer, Helene Joanin

Constructor Summary
MarshallTool()
           
 
Method Summary
static Serializable fromBytes(byte[] bytes)
          Converts byte array to an instance of java.io.Serializable
static byte[] toBytes(Serializable o)
          Converts an instance of java.io.Serializable to a serialized byte array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarshallTool

public MarshallTool()
Method Detail

toBytes

public static byte[] toBytes(Serializable o)
                      throws IOException
Converts an instance of java.io.Serializable to a serialized byte array

Parameters:
o - Object to serialize
Returns:
byte array containing the serialization of the Serializable object
Throws:
IOException - in error case

fromBytes

public static Serializable fromBytes(byte[] bytes)
                              throws IOException,
                                     ClassNotFoundException
Converts byte array to an instance of java.io.Serializable

Parameters:
bytes - A byte array containing the a serialized object
Returns:
the unmarshalled object
Throws:
IOException - in error case
ClassNotFoundException - in error case


Copyright © 2010 OW2 Consortium. All Rights Reserved.