springs.util
Class SerializationManager

java.lang.Object
  |
  +--springs.util.SerializationManager

public class SerializationManager
extends java.lang.Object

A class to manage the serialization of objects.

Author:
Sergio Ilarri Artigas

Constructor Summary
SerializationManager()
           
 
Method Summary
static byte[] convertToBytes(java.lang.Object object)
          Convert the given object into its bytes.
static java.lang.Object convertToObject(byte[] bytes)
          Convert the given bytes into an object.
static java.lang.Object convertToObject(byte[] bytes, java.lang.String codebase)
          Convert the given bytes into an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializationManager

public SerializationManager()
Method Detail

convertToObject

public static java.lang.Object convertToObject(byte[] bytes)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Convert the given bytes into an object.

Parameters:
bytes - the bytes that compose the object.
Returns:
the object.
Throws:
java.io.IOException - if the conversion fails.
java.lang.ClassNotFoundException - if the class of the object cannot be loaded.
See Also:
Object, IOException

convertToObject

public static java.lang.Object convertToObject(byte[] bytes,
                                               java.lang.String codebase)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Convert the given bytes into an object.

Parameters:
bytes - the bytes that compose the object.
codebase - a codebase to use to search for necessary classes (in case they are not locally available).
Returns:
the object.
Throws:
java.io.IOException - if the conversion fails.
java.lang.ClassNotFoundException - if the class of the object cannot be loaded.
See Also:
Object, String, IOException

convertToBytes

public static byte[] convertToBytes(java.lang.Object object)
                             throws java.io.IOException
Convert the given object into its bytes.

Parameters:
object - the object.
Returns:
the bytes that compose the object.
Throws:
java.io.IOException - if the conversion fails.
See Also:
Object, IOException