org.riotfamily.common.io
Class XmlCharRangeFilterReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.FilterReader
          extended by org.riotfamily.common.io.XmlCharRangeFilterReader
All Implemented Interfaces:
Closeable, Readable

public class XmlCharRangeFilterReader
extends FilterReader

FilterReader that silently swallows invalid XML characters like 0xb or 0x1a.

Since:
8.0
Author:
Felix Gnass [fgnass at neteye dot de]

Field Summary
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
XmlCharRangeFilterReader(Reader in)
           
 
Method Summary
protected  boolean isValidXmlChar(int c)
          Returns whether the given unicode character is valid according to the XML 1.0 standard.
 int read()
           
 int read(char[] cbuf, int off, int len)
          Reads characters into a portion of an array.
 
Methods inherited from class java.io.FilterReader
close, mark, markSupported, ready, reset, skip
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlCharRangeFilterReader

public XmlCharRangeFilterReader(Reader in)
Method Detail

isValidXmlChar

protected boolean isValidXmlChar(int c)
Returns whether the given unicode character is valid according to the XML 1.0 standard.

See Also:
http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char

read

public int read()
         throws IOException
Overrides:
read in class FilterReader
Throws:
IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Reads characters into a portion of an array.

Overrides:
read in class FilterReader
Parameters:
cbuf - Destination buffer
off - Offset at which to start storing characters
len - Maximum number of characters to read
Returns:
The number of characters read, or -1 if the end of the stream has been reached
Throws:
IOException - If an I/O error occurs