Package org.apache.lucene.analysis
Class ReusableAnalyzerBase.TokenStreamComponents
- java.lang.Object
-
- org.apache.lucene.analysis.ReusableAnalyzerBase.TokenStreamComponents
-
- Enclosing class:
- ReusableAnalyzerBase
public static class ReusableAnalyzerBase.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)andAnalyzer.reusableTokenStream(String, Reader).
-
-
Field Summary
Fields Modifier and Type Field Description protected TokenStreamsinkprotected Tokenizersource
-
Constructor Summary
Constructors Constructor Description TokenStreamComponents(Tokenizer source)Creates a newReusableAnalyzerBase.TokenStreamComponentsinstance.TokenStreamComponents(Tokenizer source, TokenStream result)Creates a newReusableAnalyzerBase.TokenStreamComponentsinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TokenStreamgetTokenStream()Returns the sinkTokenStreamprotected booleanreset(Reader reader)Resets the encapsulated components with the given reader.
-
-
-
Field Detail
-
source
protected final Tokenizer source
-
sink
protected final TokenStream sink
-
-
Constructor Detail
-
TokenStreamComponents
public TokenStreamComponents(Tokenizer source, TokenStream result)
Creates a newReusableAnalyzerBase.TokenStreamComponentsinstance.- Parameters:
source- the analyzer's tokenizerresult- the analyzer's resulting token stream
-
TokenStreamComponents
public TokenStreamComponents(Tokenizer source)
Creates a newReusableAnalyzerBase.TokenStreamComponentsinstance.- Parameters:
source- the analyzer's tokenizer
-
-
Method Detail
-
reset
protected boolean reset(Reader reader) throws IOException
Resets the encapsulated components with the given reader. This method by default returnstrueindicating that the components have been reset successfully. Subclasses ofReusableAnalyzerBasemight use their ownReusableAnalyzerBase.TokenStreamComponentsreturningfalseif the components cannot be reset.- Parameters:
reader- a reader to reset the source component- Returns:
trueif the components were reset, otherwisefalse- Throws:
IOException- if the component's reset method throws anIOException
-
getTokenStream
protected TokenStream getTokenStream()
Returns the sinkTokenStream- Returns:
- the sink
TokenStream
-
-