org.apache.lucene.analysis
Class CharFilter

java.lang.Object
  extended by java.io.Reader
      extended by java.io.FilterReader
          extended by org.apache.lucene.analysis.CharFilter
All Implemented Interfaces:
Closeable, Readable

public abstract class CharFilter
extends FilterReader

Subclasses of CharFilter can be chained to filter a Reader They can be used as Reader with additional offset correction. Tokenizers will automatically use correctOffset(int) if a CharFilter subclass is used.


Field Summary
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
CharFilter(Reader in)
          Create a new CharFilter wrapping the provided reader.
 
Method Summary
protected abstract  int correct(int currentOff)
          Subclasses override to correct the current offset.
 int correctOffset(int currentOff)
          Chains the corrected offset through the input CharFilter(s).
 
Methods inherited from class java.io.FilterReader
close, mark, markSupported, read, read, 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

CharFilter

public CharFilter(Reader in)
Create a new CharFilter wrapping the provided reader.

Parameters:
in - a Reader, can also be a CharFilter for chaining.
Method Detail

correct

protected abstract int correct(int currentOff)
Subclasses 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(s).



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