The
XMLDecoder
class is used to read XML documents created using the
XMLEncoder
and is used just like the
ObjectInputStream
. For example, one can use the following fragment to read the first object defined in an XML document written by the
XMLEncoder
class:
XMLDecoder d = new XMLDecoder(
new BufferedInputStream(
new FileInputStream("Test.xml")));
Object result = d.readObject();
d.close();
For more information you might also want to check out Long Term Persistence of JavaBeans Components: XML Schema , an article in The Swing Connection.