org.apache.lucene.analysis

## Class CharFilter

- java.lang.Object
- - java.io.Reader
  - - org.apache.lucene.analysis.CharStream
    - - org.apache.lucene.analysis.CharFilter

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Readable
  Direct Known Subclasses:
    BaseCharFilter

      public abstract class CharFilter
      extends CharStream

  Subclasses of CharFilter can be chained to filter CharStream. They can be used as `Reader` with additional offset correction. `Tokenizer`s will automatically use `correctOffset(int)` if a CharFilter/CharStream subclass is used.
  Version:
    $Id$

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CharStream` | `input`

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

      `lock`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `CharFilter(CharStream in)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `protected int` | `correct(int currentOff)` Subclass may want to override to correct the current offset.
    `int` | `correctOffset(int currentOff)` Chains the corrected offset through the input CharFilter.
    `void` | `mark(int readAheadLimit)`
    `boolean` | `markSupported()`
    `int` | `read(char[] cbuf, int off, int len)`
    `void` | `reset()`

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

      `read, read, read, ready, skip`

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

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

- - ### Field Detail

    - #### input

          protected CharStream input

  - ### Constructor Detail

    - #### CharFilter

          protected CharFilter(CharStream in)

  - ### Method Detail

    - #### correct

          protected int correct(int currentOff)

      Subclass may want to override to correct the current offset.
      Parameters:
        `currentOff` - current offset
      Returns:
        corrected offset

    - #### correctOffset

          public final int correctOffset(int currentOff)

      Chains the corrected offset through the input CharFilter.
      Specified by:
        `correctOffset` in class `CharStream`
      Parameters:
        `currentOff` - offset as seen in the output
      Returns:
        corrected offset based on the input

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in class `java.io.Reader`
      Throws:
        `java.io.IOException`

    - #### read

          public int read(char[] cbuf,
                          int off,
                          int len)
                   throws java.io.IOException

      Specified by:
        `read` in class `java.io.Reader`
      Throws:
        `java.io.IOException`

    - #### markSupported

          public boolean markSupported()

      Overrides:
        `markSupported` in class `java.io.Reader`

    - #### mark

          public void mark(int readAheadLimit)
                    throws java.io.IOException

      Overrides:
        `mark` in class `java.io.Reader`
      Throws:
        `java.io.IOException`

    - #### reset

          public void reset()
                     throws java.io.IOException

      Overrides:
        `reset` in class `java.io.Reader`
      Throws:
        `java.io.IOException`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.