org.apache.lucene.analysis
Class SinkTokenizer
- java.lang.Object
-
- org.apache.lucene.analysis.TokenStream
-
- org.apache.lucene.analysis.Tokenizer
-
- org.apache.lucene.analysis.SinkTokenizer
-
public class SinkTokenizer extends Tokenizer
A SinkTokenizer can be used to cache Tokens for use in an Analyzer- See Also:
TeeTokenFilter
-
-
Constructor Summary
Constructors Constructor and Description SinkTokenizer()SinkTokenizer(int initCap)SinkTokenizer(java.util.List input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(Token t)Override this method to cache only certain tokens, or new tokens based on the old tokens.voidclose()By default, closes the input Reader.java.util.ListgetTokens()Get the tokens in the internal List.Tokennext()Returns the next token out of the list of cached tokensvoidreset()Reset the internal data structures to the start at the front of the list of tokens.-
Methods inherited from class org.apache.lucene.analysis.TokenStream
next
-
-
-
-
Constructor Detail
-
SinkTokenizer
public SinkTokenizer(java.util.List input)
-
SinkTokenizer
public SinkTokenizer()
-
SinkTokenizer
public SinkTokenizer(int initCap)
-
-
Method Detail
-
getTokens
public java.util.List getTokens()
Get the tokens in the internal List. WARNING: Adding tokens to this list requires thereset()method to be called in order for them to be made available. Also, this Tokenizer does nothing to protect againstConcurrentModificationExceptions in the case of adds happening whileTokenStream.next(org.apache.lucene.analysis.Token)is being called.- Returns:
- A List of
Tokens
-
next
public Token next() throws java.io.IOException
Returns the next token out of the list of cached tokens- Overrides:
nextin classTokenStream- Returns:
- The next
Tokenin the Sink. - Throws:
java.io.IOException
-
add
public void add(Token t)
Override this method to cache only certain tokens, or new tokens based on the old tokens.- Parameters:
t- TheTokento add to the sink
-
close
public void close() throws java.io.IOExceptionDescription copied from class:TokenizerBy default, closes the input Reader.
-
reset
public void reset() throws java.io.IOExceptionReset the internal data structures to the start at the front of the list of tokens. Should be called if tokens were added to the list after an invocation ofTokenStream.next(Token)- Overrides:
resetin classTokenStream- Throws:
java.io.IOException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG