com.compomics.util.io
Class SerializationUtils

java.lang.Object
  extended by com.compomics.util.io.SerializationUtils

public class SerializationUtils
extends java.lang.Object

This class implements convenience methods for serialization and deserialization.

Author:
Marc Vaudel

Constructor Summary
SerializationUtils()
           
 
Method Summary
static java.lang.Object readObject(java.io.File serializedFile)
          Reads an object from a serialized file.
static void writeObject(java.lang.Object object, java.io.File destinationFile)
          Writes an object to the destination file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializationUtils

public SerializationUtils()
Method Detail

writeObject

public static void writeObject(java.lang.Object object,
                               java.io.File destinationFile)
                        throws java.io.IOException
Writes an object to the destination file.

Parameters:
object - the object
destinationFile - the destination file
Throws:
java.io.IOException - exception thrown whenever an error occurred while writing the file

readObject

public static java.lang.Object readObject(java.io.File serializedFile)
                                   throws java.io.IOException,
                                          java.lang.ClassNotFoundException
Reads an object from a serialized file.

Parameters:
serializedFile - the serialized file
Returns:
the object
Throws:
java.io.IOException - exception thrown whenever an error occurred while reading the file
java.lang.ClassNotFoundException - exception thrown whenever an unknown class is found


Copyright © 2013. All Rights Reserved.