public abstract class CharFilter
extends
Tokenizer
s will automatically use correctOffset(int)
if a CharFilter subclass is used.
This class is abstract: at a minimum you must implement ,
transforming the input in some way from input
, and correct(int)
to adjust the offsets to match the originals.
You can optionally provide more efficient implementations of additional methods like , , , but this is not required.
For examples and integration with Analyzer
, see the
Analysis package documentation
.
Modifier and Type | Field and Description |
---|---|
protected |
input
The underlying character-input stream.
|
Constructor and Description |
---|
input)
Create a new CharFilter wrapping the provided reader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying input stream.
|
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).
|
public CharFilter( input)
input
- a Reader, can also be a CharFilter for chaining.public void close() throws
NOTE:
The default implementation closes the input Reader, so
be sure to call super.close()
when overriding this method.
in interface
in interface
in class
protected abstract int correct(int currentOff)
currentOff
- current offsetpublic final int correctOffset(int currentOff)
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.