net.n3.nanoxml
Class ContentReader

java.lang.Object
  extended by java.io.Reader
      extended by net.n3.nanoxml.ContentReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

 class ContentReader
extends java.io.Reader

This reader reads data from another reader until a new element has been encountered.

Version:
$Name: RELEASE_2_2_1 $, $Revision: 1.4 $
Author:
Marc De Scheemaecker

Field Summary
private  java.lang.String buffer
          Buffer.
private  int bufferIndex
          Pointer into the buffer.
private  IXMLReader reader
          The encapsulated reader.
private  IXMLEntityResolver resolver
          The entity resolver.
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
ContentReader(IXMLReader reader, IXMLEntityResolver resolver, java.lang.String buffer)
          Creates the reader.
 
Method Summary
 void close()
          Skips remaining data and closes the stream.
protected  void finalize()
          Cleans up the object when it's destroyed.
 int read(char[] outputBuffer, int offset, int size)
          Reads a block of data.
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

private IXMLReader reader
The encapsulated reader.


buffer

private java.lang.String buffer
Buffer.


bufferIndex

private int bufferIndex
Pointer into the buffer.


resolver

private IXMLEntityResolver resolver
The entity resolver.

Constructor Detail

ContentReader

ContentReader(IXMLReader reader,
              IXMLEntityResolver resolver,
              java.lang.String buffer)
Creates the reader.

Parameters:
reader - the encapsulated reader
resolver - the entity resolver
buffer - data that has already been read from reader
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Cleans up the object when it's destroyed.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

read

public int read(char[] outputBuffer,
                int offset,
                int size)
         throws java.io.IOException
Reads a block of data.

Specified by:
read in class java.io.Reader
Parameters:
outputBuffer - where to put the read data
offset - first position in buffer to put the data
size - maximum number of chars to read
Returns:
the number of chars read, or -1 if at EOF
Throws:
java.io.IOException - if an error occurred reading the data

close

public void close()
           throws java.io.IOException
Skips remaining data and closes the stream.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader
Throws:
java.io.IOException - if an error occurred reading the data