This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.beans
class XMLDecoder

java.lang.Object extended by java.beans.XMLDecoder

Most common ways to construct:

InputStream is = …;

XMLDecoder decoder = new XMLDecoder(is);

Based on 12 examples

 

ByteArrayInputStream in = …;

XMLDecoder decoder = new XMLDecoder(in);

Based on 9 examples


public class XMLDecoder
extends Object

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.


Constructor Summary

          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.
XMLDecoder(InputStream in, Object owner, ExceptionListener exceptionListener)

          Creates a new input stream for reading archives created by the XMLEncoder class.
XMLDecoder(InputStream in, Object owner, ExceptionListener exceptionListener, ClassLoader cl)

          Creates a new input stream for reading archives created by the XMLEncoder class.
 
Method Summary
 void

          This method closes the input stream associated with this stream.
 ExceptionListener

          Gets the exception handler for this stream.
 Object

          Gets the owner of this decoder.
 Object

          Reads the next object from the underlying input stream.
 void

          Sets the exception handler for this stream to exceptionListener.
 void

          Sets the owner of this decoder to owner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDecoder

public XMLDecoder(InputStream in)
Creates a new input stream for reading archives created by the XMLEncoder class.

Parameters:
in - The underlying stream.

XMLDecoder

public XMLDecoder(InputStream in,
                  Object owner)
Creates a new input stream for reading archives created by the XMLEncoder class.

Parameters:
in - The underlying stream.
owner - The owner of this stream.

XMLDecoder

public XMLDecoder(InputStream in,
                  Object owner,
                  ExceptionListener exceptionListener)
Creates a new input stream for reading archives created by the XMLEncoder class.

Parameters:
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.

XMLDecoder

public XMLDecoder(InputStream in,
                  Object owner,
                  ExceptionListener exceptionListener,
                  ClassLoader cl)
Creates a new input stream for reading archives created by the XMLEncoder class.

Parameters:
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
Method Detail

close

public void close()
This method closes the input stream associated with this stream.


getExceptionListener

public ExceptionListener getExceptionListener()
Gets the exception handler for this stream.

Returns:
The exception handler for this stream. Will return the default exception listener if this has not explicitly been set.

getOwner

public Object getOwner()
Gets the owner of this decoder.

Returns:
The owner of this decoder.

readObject

public Object readObject()
Reads the next object from the underlying input stream.

Returns:
the next object read

setExceptionListener

public void setExceptionListener(ExceptionListener exceptionListener)
Sets the exception handler for this stream to exceptionListener. The exception handler is notified when this stream catches recoverable exceptions.

Parameters:
exceptionListener - The exception handler for this stream; if null the default exception listener will be used.

setOwner

public void setOwner(Object owner)
Sets the owner of this decoder to owner.

Parameters:
owner - The owner of this decoder.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.