buoy.xml
Class WidgetDecoder
public class WidgetDecoder
extends java.lang.Object
This class is used for reconstructing user interfaces that were serialized as XML by WidgetDecoder.
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.
WidgetDecoder(InputStream in) - Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
|
WidgetDecoder(InputStream in, ExceptionListener listener) - Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
|
Object | getObject(String name) - Get an object that was stored in the XML file.
|
Object | getRootObject() - Get the root object that was stored in the XML file.
|
static void | registerObject(String name, Object obj) - This method is used during decoding.
|
WidgetDecoder
public WidgetDecoder(InputStream in)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
in
- the InputStream from which to read the XML
WidgetDecoder
public WidgetDecoder(InputStream in,
ExceptionListener listener)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation. If
recoverable errors occur during reconstruction, the listener will be notified of them.
in
- the InputStream from which to read the XMLlistener
- the listener to notify of recoverable errors
getObject
public Object getObject(String name)
Get an object that was stored in the XML file.
name
- the name of the object to get
- the specified object, or null if there was no object in the file with that name
getRootObject
public Object getRootObject()
Get the root object that was stored in the XML file.
registerObject
public static void registerObject(String name,
Object obj)
This method is used during decoding. It records a named object into the table of objects
in the current file. If no file is currently being read, this does nothing. There usually
is no reason for you to call this directly.
Written by Peter Eastman.