org.xwiki.crypto.internal
Class SerializationUtils

java.lang.Object
  extended by org.xwiki.crypto.internal.SerializationUtils

public final class SerializationUtils
extends java.lang.Object

Utilities for serialization and deserialization.

Since:
2.5M1
Version:
$Id$

Method Summary
static java.lang.Object deserialize(byte[] serialized)
          This method will accept a serialized version of any object defined in the system.
static
<T extends java.io.Serializable>
byte[]
serialize(T toSerialize)
          Convert the given Object to a byte array which when passed to deserialize() will make the same Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

deserialize

public static java.lang.Object deserialize(byte[] serialized)
                                    throws java.io.IOException,
                                           java.lang.ClassNotFoundException
This method will accept a serialized version of any object defined in the system.

Parameters:
serialized - the byte array to create the Object from.
Returns:
an Object made from deserializing the given array.
Throws:
java.io.IOException - if something goes wrong in the serialization framework.
java.lang.ClassNotFoundException - if the required Object class is not present on the system.

serialize

public static <T extends java.io.Serializable> byte[] serialize(T toSerialize)
                        throws java.io.IOException
Convert the given Object to a byte array which when passed to deserialize() will make the same Object.

Type Parameters:
T - a serializable class.
Parameters:
toSerialize - the Object to convert into a byte array.
Returns:
the given Object as a byte array.
Throws:
java.io.IOException - if something goes wrong in the serialization framework.


Copyright © 2004-2011 XWiki. All Rights Reserved.