public abstract class CharFilter extends Reader
Reader with additional offset
correction. Tokenizers will automatically use correctOffset(int)
if a CharFilter subclass is used.
This class is abstract: at a minimum you must implement Reader.read(char[], int, int),
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 Reader.read(), Reader.read(char[]), Reader.read(java.nio.CharBuffer),
but this is not required.
For examples and integration with Analyzer, see the
Analysis package documentation.
| Constructor and Description |
|---|
CharFilter(Reader input)
Create a new CharFilter wrapping the provided reader.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying input stream.
|
int |
correctOffset(int currentOff)
Chains the corrected offset through the input
CharFilter(s).
|
public CharFilter(Reader input)
input - a Reader, can also be a CharFilter for chaining.public void close()
throws IOException
NOTE:
The default implementation closes the input Reader, so
be sure to call super.close() when overriding this method.
close in interface Closeableclose in interface AutoCloseableclose in class ReaderIOExceptionpublic final int correctOffset(int currentOff)
Copyright © 2010 - 2020 Adobe. All Rights Reserved