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

    Fields inherited from class java.io.FilterReader

    in

    Fields inherited from class java.io.Reader

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

    Methods inherited from class java.io.FilterReader

    close, mark, markSupported, ready, reset, skip

    Methods inherited from class java.io.Reader

    nullReader, read, read, transferTo

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 class java.io.FilterReader
      Throws:
      java.io.IOException
    • read

      public int read​(char[] cbuf, int off, int len) throws java.io.IOException
      Overrides:
      read in class java.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