net.sourceforge.jaulp.io
Class SerializedObjectUtils

java.lang.Object
  extended by net.sourceforge.jaulp.io.SerializedObjectUtils

public final class SerializedObjectUtils
extends java.lang.Object

Helper-class for make exact copys from serialized objects.

Version:
1.0
Author:
Asterios Raptis

Method Summary
static byte[] convert2ByteArray(java.lang.Object object)
          The Method convert2ByteArray() serialize an Object to byte array.
static java.lang.Object convert2Object(byte[] byteArray)
          The Method convert2Object() converts the bytearray into an Object.
static java.lang.Object copySerializedObject(java.lang.Object orig)
          Copys the given Object and returns the copy from the object or null if the object can't be serialized.
static java.lang.Object readSerializedObjectFromFile(java.io.File file)
          Reads the object from the given file.
static boolean writeSerializedObjectToFile(java.lang.Object obj, java.io.File file)
          Writes the given object to the given File.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convert2ByteArray

public static byte[] convert2ByteArray(java.lang.Object object)
The Method convert2ByteArray() serialize an Object to byte array.

Parameters:
object - The Object to convert into a bytearray.
Returns:
The bytearray from the Object.

convert2Object

public static java.lang.Object convert2Object(byte[] byteArray)
The Method convert2Object() converts the bytearray into an Object.

Parameters:
byteArray - The bytearray to convert into an Object.
Returns:
The Object the was converted from the bytearray.

copySerializedObject

public static java.lang.Object copySerializedObject(java.lang.Object orig)
Copys the given Object and returns the copy from the object or null if the object can't be serialized.

Parameters:
orig - The object to copy.
Returns:
Returns a copy from the original object.

readSerializedObjectFromFile

public static java.lang.Object readSerializedObjectFromFile(java.io.File file)
Reads the object from the given file.

Parameters:
file - In that file is the object saved.
Returns:
The object in the file or null.

writeSerializedObjectToFile

public static boolean writeSerializedObjectToFile(java.lang.Object obj,
                                                  java.io.File file)
Writes the given object to the given File.

Parameters:
obj - The object to write to the File.
file - In this file will be the object saved.
Returns:
true if the object was written to the file otherwise false.


Copyright © 2010. All Rights Reserved.