Constructors Summary |
---|
public XMLDecoder(InputStream in)Creates a new input stream for reading archives
created by the XMLEncoder class.
this(in, null);
|
public XMLDecoder(InputStream in, Object owner)Creates a new input stream for reading archives
created by the XMLEncoder class.
this(in, owner, null);
|
public XMLDecoder(InputStream in, Object owner, ExceptionListener exceptionListener)Creates a new input stream for reading archives
created by the XMLEncoder class.
this(in, owner, exceptionListener, null);
|
public XMLDecoder(InputStream in, Object owner, ExceptionListener exceptionListener, ClassLoader cl)Creates a new input stream for reading archives
created by the XMLEncoder class.
this.in = in;
setOwner(owner);
setExceptionListener(exceptionListener);
setClassLoader(cl);
|
Methods Summary |
---|
public void | close()This method closes the input stream associated
with this stream.
if (in != null) {
getHandler();
try {
in.close();
}
catch (IOException e) {
getExceptionListener().exceptionThrown(e);
}
}
|
private java.lang.ClassLoader | getClassLoader()Return the class loader used to instantiate objects. If the class loader
has not been explicitly set then null is returned.
if (clref != null) {
return (ClassLoader)clref.get();
}
return null;
|
public java.beans.ExceptionListener | getExceptionListener()Gets the exception handler for this stream.
return (exceptionListener != null) ? exceptionListener :
Statement.defaultExceptionListener;
|
private com.sun.beans.ObjectHandler | getHandler()Returns the object handler for input stream.
The object handler is created if necessary.
if ( handler == null ) {
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
SAXParser parser = factory.newSAXParser();
handler = new ObjectHandler( this, getClassLoader() );
parser.parse( in, handler );
}
catch ( ParserConfigurationException e ) {
getExceptionListener().exceptionThrown( e );
}
catch ( SAXException se ) {
Exception e = se.getException();
if ( e == null ) {
e = se;
}
getExceptionListener().exceptionThrown( e );
}
catch ( IOException ioe ) {
getExceptionListener().exceptionThrown( ioe );
}
}
return handler;
|
public java.lang.Object | getOwner()Gets the owner of this decoder.
return owner;
|
public java.lang.Object | readObject()Reads the next object from the underlying input stream.
if (in == null) {
return null;
}
return getHandler().dequeueResult();
|
private void | setClassLoader(java.lang.ClassLoader cl)Set the class loader used to instantiate objects for this stream.
if (cl != null) {
this.clref = new WeakReference(cl);
}
|
public void | setExceptionListener(java.beans.ExceptionListener exceptionListener)Sets the exception handler for this stream to exceptionListener .
The exception handler is notified when this stream catches recoverable
exceptions.
this.exceptionListener = exceptionListener;
|
public void | setOwner(java.lang.Object owner)Sets the owner of this decoder to owner .
this.owner = owner;
|