public class WidgetDecoder
extends java.lang.Object
To use this class, simply create a new WidgetDecoder, passing it an input stream from which it can
read the XML file. You then can call getRootObject()
to get the root object of the hierarchy, or getObject()
to look up any Widget in the file by name.
Note that WidgetDecoder does not close the stream you pass to it, so be sure to close the stream when you are done with it.
Constructor and Description |
---|
WidgetDecoder(java.io.InputStream in)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
|
WidgetDecoder(java.io.InputStream in,
java.beans.ExceptionListener listener)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
|
WidgetDecoder(java.io.InputStream in,
java.beans.ExceptionListener listener,
java.util.ResourceBundle resources)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
|
WidgetDecoder(java.io.InputStream in,
java.util.ResourceBundle resources)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getObject(java.lang.String name)
Get an object that was stored in the XML file.
|
java.lang.Object |
getRootObject()
Get the root object that was stored in the XML file.
|
static void |
registerObject(java.lang.String name,
java.lang.Object obj)
This method is used during decoding.
|
public WidgetDecoder(java.io.InputStream in)
in
- the InputStream from which to read the XMLpublic WidgetDecoder(java.io.InputStream in, java.util.ResourceBundle resources)
in
- the InputStream from which to read the XMLresources
- a ResourceBundle from which to obtain localized Strings. See
WidgetLocalization
for details.public WidgetDecoder(java.io.InputStream in, java.beans.ExceptionListener listener)
in
- the InputStream from which to read the XMLlistener
- the listener to notify of recoverable errorspublic WidgetDecoder(java.io.InputStream in, java.beans.ExceptionListener listener, java.util.ResourceBundle resources)
in
- the InputStream from which to read the XMLlistener
- the listener to notify of recoverable errorsresources
- a ResourceBundle from which to obtain localized Strings. See
WidgetLocalization
for details.public java.lang.Object getRootObject()
public java.lang.Object getObject(java.lang.String name)
name
- the name of the object to getpublic static void registerObject(java.lang.String name, java.lang.Object obj)
Written by Peter Eastman.