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 ofTokenFilter
which also serves as theTokenStream
returned byAnalyzer.tokenStream(String, Reader)
andAnalyzer.reusableTokenStream(String, Reader)
.
-
-
Field Summary
Fields Modifier and Type Field Description protected TokenStream
sink
protected Tokenizer
source
-
Constructor Summary
Constructors Constructor Description TokenStreamComponents(Tokenizer source)
Creates a newReusableAnalyzerBase.TokenStreamComponents
instance.TokenStreamComponents(Tokenizer source, TokenStream result)
Creates a newReusableAnalyzerBase.TokenStreamComponents
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TokenStream
getTokenStream()
Returns the sinkTokenStream
protected boolean
reset(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.TokenStreamComponents
instance.- Parameters:
source
- the analyzer's tokenizerresult
- the analyzer's resulting token stream
-
TokenStreamComponents
public TokenStreamComponents(Tokenizer source)
Creates a newReusableAnalyzerBase.TokenStreamComponents
instance.- 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 returnstrue
indicating that the components have been reset successfully. Subclasses ofReusableAnalyzerBase
might use their ownReusableAnalyzerBase.TokenStreamComponents
returningfalse
if the components cannot be reset.- Parameters:
reader
- a reader to reset the source component- Returns:
true
if 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
-
-