Class JDOMSource.JDOMInputSource

java.lang.Object
  extended by org.xml.sax.InputSource
      extended by JDOMSource.JDOMInputSource
Enclosing class:
JDOMSource

private static class JDOMSource.JDOMInputSource
extends org.xml.sax.InputSource

A subclass of the SAX InputSource interface that wraps a JDOM Document.

This class is nested in JDOMSource as it is not intented to be used independently of its friend: DocumentReader.

See Also:
Document

Field Summary
private  java.lang.Object source
          The source as a JDOM document or a list of JDOM nodes.
 
Constructor Summary
JDOMSource.JDOMInputSource(Document document)
          Builds a InputSource wrapping the specified JDOM Document.
JDOMSource.JDOMInputSource(java.util.List nodes)
          Builds a InputSource wrapping a list of JDOM nodes.
 
Method Summary
 java.io.Reader getCharacterStream()
          Gets the character stream for this input source.
 java.lang.Object getSource()
          Returns the source.
 void setCharacterStream(java.io.Reader characterStream)
          Sets the character stream for this input source.
 
Methods inherited from class org.xml.sax.InputSource
getByteStream, getEncoding, getPublicId, getSystemId, setByteStream, setEncoding, setPublicId, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private java.lang.Object source
The source as a JDOM document or a list of JDOM nodes.

Constructor Detail

JDOMSource.JDOMInputSource

public JDOMSource.JDOMInputSource(Document document)
Builds a InputSource wrapping the specified JDOM Document.

Parameters:
document - the source document.

JDOMSource.JDOMInputSource

public JDOMSource.JDOMInputSource(java.util.List nodes)
Builds a InputSource wrapping a list of JDOM nodes.

Parameters:
nodes - the source JDOM nodes.
Method Detail

getSource

public java.lang.Object getSource()
Returns the source.

Returns:
the source as a JDOM document or a list of JDOM nodes.

setCharacterStream

public void setCharacterStream(java.io.Reader characterStream)
                        throws java.lang.UnsupportedOperationException
Sets the character stream for this input source.

This implementation always throws an UnsupportedOperationException as the only source stream supported is the source JDOM document.

Overrides:
setCharacterStream in class org.xml.sax.InputSource
Parameters:
characterStream - a character stream containing an XML document.
Throws:
java.lang.UnsupportedOperationException - always!

getCharacterStream

public java.io.Reader getCharacterStream()
Gets the character stream for this input source.

Note that this method is only provided to make this InputSource implementation acceptable by any XML parser. As it generates an in-memory string representation of the JDOM document, it is quite inefficient from both speed and memory consumption points of view.

Overrides:
getCharacterStream in class org.xml.sax.InputSource
Returns:
a Reader to a string representation of the source JDOM document.