org.apache.commons.io.input

## Class CharacterSetFilterReader

- java.lang.Object
- - java.io.Reader
  - - java.io.FilterReader
    - - org.apache.commons.io.input.AbstractCharacterFilterReader
      - - org.apache.commons.io.input.CharacterSetFilterReader

- All Implemented Interfaces:
    Closeable, AutoCloseable, Readable

      public class CharacterSetFilterReader
      extends AbstractCharacterFilterReader

  A filter reader that removes a given set of characters represented as `int` code points, handy to remove known junk characters from CSV files for example.

  This class must convert each `int` read to an `Integer`. You can increase the Integer cache with a system property, see `Integer`.

- - ### Field Summary

    - ### Fields inherited from class java.io.FilterReader

      `in`

    - ### Fields inherited from class java.io.Reader

      `lock`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CharacterSetFilterReader(Reader reader, Set<Integer> skip)` Constructs a new reader.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `filter(int ch)` Returns true if the given character should be filtered out, false to keep the character.

    - ### Methods inherited from class org.apache.commons.io.input.AbstractCharacterFilterReader

      `read, read`

    - ### Methods inherited from class java.io.FilterReader

      `close, mark, markSupported, ready, reset, skip`

    - ### Methods inherited from class java.io.Reader

      `read, read`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CharacterSetFilterReader

          public CharacterSetFilterReader(Reader reader,
                                          Set<Integer> skip)

      Constructs a new reader.
      Parameters:
        `reader` - the reader to filter.
        `skip` - the set of characters to filter out.

  - ### Method Detail

    - #### filter

          protected boolean filter(int ch)

      Description copied from class: `AbstractCharacterFilterReader`
      Returns true if the given character should be filtered out, false to keep the character.
      Specified by:
        `filter` in class `AbstractCharacterFilterReader`
      Parameters:
        `ch` - the character to test.
      Returns:
        true if the given character should be filtered out, false to keep the character.

Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.