public abstract class Tokenizer extends TokenStream
This is an abstract class; subclasses must override TokenStream.incrementToken()
NOTE: Subclasses overriding TokenStream.incrementToken()
must
call AttributeSource.clearAttributes()
before
setting attributes.
AttributeSource.AttributeFactory, AttributeSource.State
Modifier and Type | Field and Description |
---|---|
protected Reader |
input
The text source for this Tokenizer.
|
Modifier | Constructor and Description |
---|---|
protected |
Tokenizer(AttributeSource.AttributeFactory factory,
Reader input)
Construct a token stream processing the given input using the given AttributeFactory.
|
protected |
Tokenizer(AttributeSource source,
Reader input)
Construct a token stream processing the given input using the given AttributeSource.
|
protected |
Tokenizer(Reader input)
Construct a token stream processing the given input.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases resources associated with this stream.
|
protected int |
correctOffset(int currentOff)
Return the corrected offset.
|
void |
setReader(Reader input)
Expert: Set a new reader on the Tokenizer.
|
end, incrementToken, reset
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, restoreState
protected Reader input
protected Tokenizer(Reader input)
protected Tokenizer(AttributeSource.AttributeFactory factory, Reader input)
protected Tokenizer(AttributeSource source, Reader input)
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 Closeable
close
in class TokenStream
IOException
protected final int correctOffset(int currentOff)
input
is a CharFilter
subclass
this method calls CharFilter.correctOffset(int)
, else returns currentOff
.currentOff
- offset as seen in the outputCharFilter.correctOffset(int)
public final void setReader(Reader input) throws IOException
IOException
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.