org.apache.lucene.analysis
Class CachingTokenFilter

java.lang.Object
  extended by org.apache.lucene.analysis.TokenStream
      extended by org.apache.lucene.analysis.TokenFilter
          extended by org.apache.lucene.analysis.CachingTokenFilter

public class CachingTokenFilter
extends TokenFilter

This class can be used if the Tokens of a TokenStream are intended to be consumed more than once. It caches all Tokens locally in a List. CachingTokenFilter implements the optional method TokenStream.reset(), which repositions the stream to the first Token.


Field Summary
 
Fields inherited from class org.apache.lucene.analysis.TokenFilter
input
 
Constructor Summary
CachingTokenFilter(TokenStream input)
           
 
Method Summary
 Token next()
          Returns the next token in the stream, or null at EOS.
 void reset()
          Resets this stream to the beginning.
 
Methods inherited from class org.apache.lucene.analysis.TokenFilter
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingTokenFilter

public CachingTokenFilter(TokenStream input)
Method Detail

next

public Token next()
           throws java.io.IOException
Description copied from class: TokenStream
Returns the next token in the stream, or null at EOS.

Specified by:
next in class TokenStream
Throws:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
Description copied from class: TokenStream
Resets this stream to the beginning. This is an optional operation, so subclasses may or may not implement this method. Reset() is not needed for the standard indexing process. However, if the Tokens of a TokenStream are intended to be consumed more than once, it is neccessary to implement reset().

Overrides:
reset in class TokenStream
Throws:
java.io.IOException


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.