Package 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:
Closeable,AutoCloseable,Readable
- Direct Known Subclasses:
BaseCharFilter,PersianCharFilter
public abstract class CharFilter extends CharStream
Subclasses of CharFilter can be chained to filter CharStream. They can be used asReaderwith additional offset correction.Tokenizers will automatically usecorrectOffset(int)if a CharFilter/CharStream subclass is used.
-
-
Field Summary
Fields Modifier and Type Field Description protected CharStreaminput
-
Constructor Summary
Constructors Modifier Constructor Description protectedCharFilter(CharStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected intcorrect(int currentOff)Subclass may want to override to correct the current offset.intcorrectOffset(int currentOff)Chains the corrected offset through the input CharFilter.voidmark(int readAheadLimit)booleanmarkSupported()intread(char[] cbuf, int off, int len)voidreset()-
Methods inherited from class java.io.Reader
nullReader, read, read, read, ready, skip, transferTo
-
-
-
-
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:
correctOffsetin classCharStream- Parameters:
currentOff- offset as seen in the output- Returns:
- corrected offset based on the input
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
read
public int read(char[] cbuf, int off, int len) throws IOException- Specified by:
readin classReader- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classReader
-
mark
public void mark(int readAheadLimit) throws IOException- Overrides:
markin classReader- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classReader- Throws:
IOException
-
-