Package org.apache.lucene.analysis
Class Analyzer.TokenStreamComponents
- java.lang.Object
-
- org.apache.lucene.analysis.Analyzer.TokenStreamComponents
-
- Enclosing class:
- Analyzer
public static class Analyzer.TokenStreamComponents extends Object
This class encapsulates the outer components of a token stream. It provides access to the source (Tokenizer) and the outer end (sink), an instance ofTokenFilterwhich also serves as theTokenStreamreturned byAnalyzer.tokenStream(String, Reader).
-
-
Field Summary
Fields Modifier and Type Field Description protected TokenStreamsinkSink tokenstream, such as the outer tokenfilter decorating the chain.protected TokenizersourceOriginal source of the tokens.
-
Constructor Summary
Constructors Constructor Description TokenStreamComponents(Tokenizer source)Creates a newAnalyzer.TokenStreamComponentsinstance.TokenStreamComponents(Tokenizer source, TokenStream result)Creates a newAnalyzer.TokenStreamComponentsinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenizergetTokenizer()Returns the component'sTokenizerTokenStreamgetTokenStream()Returns the sinkTokenStreamprotected voidsetReader(Reader reader)Resets the encapsulated components with the given reader.
-
-
-
Field Detail
-
source
protected final Tokenizer source
Original source of the tokens.
-
sink
protected final TokenStream sink
Sink tokenstream, such as the outer tokenfilter decorating the chain. This can be the source if there are no filters.
-
-
Constructor Detail
-
TokenStreamComponents
public TokenStreamComponents(Tokenizer source, TokenStream result)
Creates a newAnalyzer.TokenStreamComponentsinstance.- Parameters:
source- the analyzer's tokenizerresult- the analyzer's resulting token stream
-
TokenStreamComponents
public TokenStreamComponents(Tokenizer source)
Creates a newAnalyzer.TokenStreamComponentsinstance.- Parameters:
source- the analyzer's tokenizer
-
-
Method Detail
-
setReader
protected void setReader(Reader reader) throws IOException
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
public TokenStream getTokenStream()
Returns the sinkTokenStream- Returns:
- the sink
TokenStream
-
-