net.n3.nanoxml
Class CDATAReader

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

 class CDATAReader
extends java.io.Reader

This reader reads data from another reader until the end of a CDATA section (]]>) has been encountered.

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

Field Summary
private  boolean atEndOfData
          True if the end of the stream has been reached.
private  IXMLReader reader
          The encapsulated reader.
private  char savedChar
          Saved char.
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
CDATAReader(IXMLReader reader)
          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[] buffer, 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.


savedChar

private char savedChar
Saved char.


atEndOfData

private boolean atEndOfData
True if the end of the stream has been reached.

Constructor Detail

CDATAReader

CDATAReader(IXMLReader reader)
Creates the reader.

Parameters:
reader - the encapsulated 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[] buffer,
                int offset,
                int size)
         throws java.io.IOException
Reads a block of data.

Specified by:
read in class java.io.Reader
Parameters:
buffer - 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