Class AbstractCharacterFilterReader

java.lang.Object
java.io.Reader
java.io.FilterReader
org.apache.commons.io.input.AbstractCharacterFilterReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable
Direct Known Subclasses:
CharacterFilterReader, CharacterSetFilterReader

public abstract class AbstractCharacterFilterReader extends FilterReader
A filter reader that filters out characters where subclasses decide which characters to filter out.
  • Field Details

    • SKIP_NONE

      protected static final IntPredicate SKIP_NONE
      Skips nothing.
      Since:
      2.9.0
    • skip

      private final IntPredicate skip
  • Constructor Details

    • AbstractCharacterFilterReader

      protected AbstractCharacterFilterReader(Reader reader)
      Constructs a new reader.
      Parameters:
      reader - the reader to filter
    • AbstractCharacterFilterReader

      protected AbstractCharacterFilterReader(Reader reader, IntPredicate skip)
      Constructs a new reader.
      Parameters:
      reader - the reader to filter.
      skip - Skip test.
      Since:
      2.9.0
  • Method Details

    • 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 IOException
      Overrides:
      read in class FilterReader
      Throws:
      IOException
    • read

      public int read(char[] cbuf, int off, int len) throws IOException
      Overrides:
      read in class FilterReader
      Throws:
      IOException