| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class provides some simple Serialization primitives
Method Summary | |
static Object | duplicate(Object in) Duplicates the given object using serialization - completely decouples both copies. |
static Object | fileToObject(File file) Attempts to read an Object from the given file (assume Object is serializable) |
static void | main(String[] args) |
static void | objectToFile(Serializable in, File out) Attempts to save the given Serializable object to the given file |
static byte[] | toByteArray(Object o) Serialises the given object into a byte[] |
static Object | toObject(byte[] in) Reconstructs a serialised object from a byte[] to an Object |
Method Detail |
public static Object duplicate(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
public static Object fileToObject(File file)
throws java.io.IOException,
java.lang.ClassNotFoundException
public static void main(String[] args)
public static void objectToFile(Serializable in, File out)
throws java.io.IOException
Attempts to save the given Serializable object to the given file
public static byte[] toByteArray(Object o)
public static Object toObject(byte[] in)
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |