Package org.apache.lucene.analysis
Class Analyzer.TokenStreamComponents
java.lang.Object
org.apache.lucene.analysis.Analyzer.TokenStreamComponents
- Enclosing class:
- Analyzer
This class encapsulates the outer components of a token stream. It provides
access to the source (
Tokenizer
) and the outer end (sink), an
instance of TokenFilter
which also serves as the
TokenStream
returned by
Analyzer.tokenStream(String, Reader)
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final TokenStream
Sink tokenstream, such as the outer tokenfilter decorating the chain.protected final Tokenizer
Original source of the tokens. -
Constructor Summary
ConstructorsConstructorDescriptionTokenStreamComponents
(Tokenizer source) Creates a newAnalyzer.TokenStreamComponents
instance.TokenStreamComponents
(Tokenizer source, TokenStream result) Creates a newAnalyzer.TokenStreamComponents
instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the component'sTokenizer
Returns the sinkTokenStream
protected void
Resets the encapsulated components with the given reader.
-
Field Details
-
source
Original source of the tokens. -
sink
Sink tokenstream, such as the outer tokenfilter decorating the chain. This can be the source if there are no filters.
-
-
Constructor Details
-
TokenStreamComponents
Creates a newAnalyzer.TokenStreamComponents
instance.- Parameters:
source
- the analyzer's tokenizerresult
- the analyzer's resulting token stream
-
TokenStreamComponents
Creates a newAnalyzer.TokenStreamComponents
instance.- Parameters:
source
- the analyzer's tokenizer
-
-
Method Details
-
setReader
Resets the encapsulated components with the given reader. If the components cannot be reset, an Exception should be thrown.- Parameters:
reader
- a reader to reset the source component- Throws:
IOException
- if the component's reset method throws anIOException
-
getTokenStream
Returns the sinkTokenStream
- Returns:
- the sink
TokenStream
-
getTokenizer
Returns the component'sTokenizer
- Returns:
- Component's
Tokenizer
-