java.lang.Object | |
↳ | java.beans.XMLDecoder |
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.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new input stream for reading archives
created by the
XMLEncoder class. | |||||||||||
Creates a new input stream for reading archives
created by the
XMLEncoder class. | |||||||||||
Creates a new input stream for reading archives
created by the
XMLEncoder class. | |||||||||||
Creates a new input stream for reading archives
created by the
XMLEncoder class. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method closes the input stream associated
with this stream.
| |||||||||||
Gets the exception handler for this stream.
| |||||||||||
Gets the owner of this decoder.
| |||||||||||
Reads the next object from the underlying input stream.
| |||||||||||
Sets the exception handler for this stream to
exceptionListener . | |||||||||||
Sets the owner of this decoder to
owner . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a new input stream for reading archives
created by the XMLEncoder
class.
in | The underlying stream. |
---|
Creates a new input stream for reading archives
created by the XMLEncoder
class.
in | The underlying stream. |
---|---|
owner | The owner of this stream. |
Creates a new input stream for reading archives
created by the XMLEncoder
class.
in | the underlying stream. |
---|---|
owner | the owner of this stream. |
exceptionListener | the exception handler for the stream;
if null the default exception listener will be used.
|
Creates a new input stream for reading archives
created by the XMLEncoder
class.
in | the underlying stream. null may be passed without
error, though the resulting XMLDecoder will be useless |
---|---|
owner | the owner of this stream. null is a legal
value |
exceptionListener | the exception handler for the stream, or
null to use the default |
cl | the class loader used for instantiating objects.
null indicates that the default class loader should
be used |
This method closes the input stream associated with this stream.
Gets the exception handler for this stream.
Reads the next object from the underlying input stream.
ArrayIndexOutOfBoundsException | if the stream contains no objects (or no more objects) |
---|
Sets the exception handler for this stream to exceptionListener
.
The exception handler is notified when this stream catches recoverable
exceptions.
exceptionListener | The exception handler for this stream;
if null the default exception listener will be used. |
---|
Sets the owner of this decoder to owner
.
owner | The owner of this decoder. |
---|