    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.io.input;
    018
    019import java.io.Reader;
    020import java.util.function.IntPredicate;
    021
    022/**
    023 * A filter reader that filters out a given character represented as an {@code int} code point, handy to remove
    024 * known junk characters from CSV files for example. This class is the most efficient way to filter out a single
    025 * character, as opposed to using a {@link CharacterSetFilterReader}. You can also nest {@link CharacterFilterReader}s.
    026 */
    027public class CharacterFilterReader extends AbstractCharacterFilterReader {
    028
    029    /**
    030     * Constructs a new reader.
    031     *
    032     * @param reader
    033     *            the reader to filter.
    034     * @param skip
    035     *            the character to filter out.
    036     */
    037    public CharacterFilterReader(final Reader reader, final int skip) {
    038        super(reader, c -> c == skip);
    039    }
    040
    041    /**
    042     * Constructs a new reader.
    043     *
    044     * @param reader the reader to filter.
    045     * @param skip Skip test.
    046     * @since 2.9.0
    047     */
    048    public CharacterFilterReader(final Reader reader, final IntPredicate skip) {
    049        super(reader, skip);
    050    }
    051
    052}