Package rs.baselib.io
Class AbstractReaderFilter
java.lang.Object
java.io.Reader
java.io.FilterReader
rs.baselib.io.AbstractReaderFilter
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
- Direct Known Subclasses:
XmlReaderFilter
public abstract class AbstractReaderFilter
extends java.io.FilterReader
Abstract implementation of a reader that can filter characters.
Descendants shall override isValidChar(char) only.
- Author:
- ralph
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AbstractReaderFilter(java.io.Reader in)Constructor. -
Method Summary
Modifier and Type Method Description abstract booleanisValidChar(char c)Tells the filter reader whether the given character is valid or not.intread()intread(char[] cbuf, int off, int len)
-
Constructor Details
-
AbstractReaderFilter
public AbstractReaderFilter(java.io.Reader in)Constructor.- Parameters:
in- - the underlying reader
-
-
Method Details
-
read
public int read() throws java.io.IOException- Overrides:
readin classjava.io.FilterReader- Throws:
java.io.IOException
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.FilterReader- Throws:
java.io.IOException
-
isValidChar
public abstract boolean isValidChar(char c)Tells the filter reader whether the given character is valid or not.- Parameters:
c- the character to be validated- Returns:
truewhen the character can be delivered
-