Package org.apache.commons.io.input
Class AbstractCharacterFilterReader
- java.lang.Object
-
- java.io.Reader
-
- java.io.FilterReader
-
- org.apache.commons.io.input.AbstractCharacterFilterReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
- Direct Known Subclasses:
CharacterFilterReader,CharacterSetFilterReader
public abstract class AbstractCharacterFilterReader extends java.io.FilterReaderA filter reader that filters out characters where subclasses decide which characters to filter out.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.function.IntPredicateSKIP_NONESkips nothing.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCharacterFilterReader(java.io.Reader reader)Constructs a new reader.protectedAbstractCharacterFilterReader(java.io.Reader reader, java.util.function.IntPredicate skip)Constructs a new reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanfilter(int ch)Returns true if the given character should be filtered out, false to keep the character.intread()intread(char[] cbuf, int off, int len)
-
-
-
Constructor Detail
-
AbstractCharacterFilterReader
protected AbstractCharacterFilterReader(java.io.Reader reader)
Constructs a new reader.- Parameters:
reader- the reader to filter
-
AbstractCharacterFilterReader
protected AbstractCharacterFilterReader(java.io.Reader reader, java.util.function.IntPredicate skip)Constructs a new reader.- Parameters:
reader- the reader to filter.skip- Skip test.- Since:
- 2.9.0
-
-
Method Detail
-
filter
protected boolean filter(int ch)
Returns true if the given character should be filtered out, false to keep the character.- Parameters:
ch- the character to test.- Returns:
- true if the given character should be filtered out, false to keep the character.
-
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
-
-