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 boolean
isValidChar(char c)
Tells the filter reader whether the given character is valid or not.int
read()
int
read(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:
read
in classjava.io.FilterReader
- Throws:
java.io.IOException
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOException- Overrides:
read
in 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:
true
when the character can be delivered
-