Package rs.baselib.io

Class AbstractReaderFilter

java.lang.Object
java.io.Reader
java.io.FilterReader
rs.baselib.io.AbstractReaderFilter
All Implemented Interfaces:
Closeable, AutoCloseable, Readable
Direct Known Subclasses:
XmlReaderFilter

public abstract class AbstractReaderFilter extends FilterReader
Abstract implementation of a reader that can filter characters.

Descendants shall override isValidChar(char) only.

Author:
ralph
  • Constructor Details

    • AbstractReaderFilter

      public AbstractReaderFilter(Reader in)
      Constructor.
      Parameters:
      in - - the underlying reader
  • Method Details

    • 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
    • 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