org.apache.xerces.xinclude
Class XIncludeTextReader

java.lang.Object
  extended by org.apache.xerces.xinclude.XIncludeTextReader
Direct Known Subclasses:
XInclude11TextReader

public class XIncludeTextReader
extends java.lang.Object

This class is used for reading resources requested in <include> elements, when the parse attribute of the <include> element is "text". Using this class will open the location, detect the encoding, and discard the byte order mark, if applicable. REVISIT: Much of the code in this class is taken from XMLEntityManager. It would be nice if this code could be shared in some way. However, since XMLEntityManager is used for reading files as XML, and this needs to read files as text, there would need to be some refactoring done.

Version:
$Id: XIncludeTextReader.java 572046 2007-09-02 17:33:57Z mrglavas $
Author:
Michael Glavassevich, IBM, Peter McCracken, IBM, Ankit Pasricha, IBM, Arun Yadav, Sun Microsystems Inc.
See Also:
XIncludeHandler

Constructor Summary
XIncludeTextReader(XMLInputSource source, XIncludeHandler handler, int bufferSize)
          Construct the XIncludeReader using the XMLInputSource and XIncludeHandler.
 
Method Summary
 void close()
          Closes the stream.
 void parse()
          Read the input stream as text, and pass the text on to the XIncludeHandler using calls to characters().
 void setErrorReporter(XMLErrorReporter errorReporter)
          Sets the XMLErrorReporter used for reporting errors while reading the text include.
 void setInputSource(XMLInputSource source)
          Sets the input source on this text reader.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XIncludeTextReader

public XIncludeTextReader(XMLInputSource source,
                          XIncludeHandler handler,
                          int bufferSize)
                   throws java.io.IOException
Construct the XIncludeReader using the XMLInputSource and XIncludeHandler.

Parameters:
source - The XMLInputSource to use.
handler - The XIncludeHandler to use.
bufferSize - The size of this text reader's buffer.
Throws:
java.io.IOException
Method Detail

setErrorReporter

public void setErrorReporter(XMLErrorReporter errorReporter)
Sets the XMLErrorReporter used for reporting errors while reading the text include.

Parameters:
errorReporter - the XMLErrorReporter to be used for reporting errors.

parse

public void parse()
           throws java.io.IOException
Read the input stream as text, and pass the text on to the XIncludeHandler using calls to characters(). This will read all of the text it can from the resource.

Throws:
java.io.IOException

setInputSource

public void setInputSource(XMLInputSource source)
Sets the input source on this text reader.

Parameters:
source - The XMLInputSource to use.

close

public void close()
           throws java.io.IOException
Closes the stream. Call this after parse(), or when there is no longer any need for this object.

Throws:
java.io.IOException