|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wox.serial.Easy
public class Easy
The Easy
class is used to serialize/de-serialize objects to/from XML.
It has two static methods. The save
method serializes an object to XML
and stores it in an XML file; and the load
method de-serializes an object
from an XML file.
Constructor Summary | |
---|---|
Easy()
|
Method Summary | |
---|---|
static java.lang.Object |
load(java.lang.String filename)
This method loads an object from the specified XML file. |
static void |
save(java.lang.Object ob,
java.lang.String filename)
This method saves an object to the specified XML file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Easy()
Method Detail |
---|
public static void save(java.lang.Object ob, java.lang.String filename)
ArrayList list = new ArrayList();
list.add(new Product("Beans", 500));
list.add(new Product("Bread", 200));
Easy.save(list, "list.xml");
ob
- Any object.filename
- This is the XML file where the object will be stored.public static java.lang.Object load(java.lang.String filename)
ArrayList list = (ArrayList)Easy.load("list.xml");
filename
- The XML file where the object is stored.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |