XMLDecoder (Java Platform SE 8 ) (original) (raw)


public class XMLDecoder
extends Object
implements AutoCloseable
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 outLong Term Persistence of JavaBeans Components: XML Schema, an article in The Swing Connection.
Since:
1.4
See Also:
XMLEncoder, ObjectInputStream

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.