|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fipaos.util.Serialize
This class provides some simple Serialization primitives
Constructor Summary | |
Serialize()
|
Method Summary | |
static java.lang.Object |
duplicate(java.lang.Object in)
Duplicates the given object using serialization - completely decouples both copies. |
static java.lang.Object |
fileToObject(java.io.File file)
Attempts to read an Object from the given file (assume Object is serializable) |
static void |
main(java.lang.String[] args)
|
static void |
objectToFile(java.io.Serializable in,
java.io.File out)
Attempts to save the given Serializable object to the given file |
static byte[] |
toByteArray(java.lang.Object o)
Serialises the given object into a byte[] |
static java.lang.Object |
toObject(byte[] in)
Reconstructs a serialised object from a byte[] to an Object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Serialize()
Method Detail |
public static byte[] toByteArray(java.lang.Object o)
o
- Object to serialisepublic static java.lang.Object toObject(byte[] in)
in
- The byte[] containing a serialised objectpublic static java.lang.Object duplicate(java.lang.Object in)
Duplicates the given object using serialization - completely decouples both copies.
WARNING: This is potentially an order of magnitude slower than manually cloning an object
in
- Object to duplicatepublic static void objectToFile(java.io.Serializable in, java.io.File out) throws java.io.IOException
Attempts to save the given Serializable object to the given file
public static java.lang.Object fileToObject(java.io.File file) throws java.io.IOException, java.lang.ClassNotFoundException
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |