Class Tokenizer

    • Field Detail

      • input

        protected Reader input
        The text source for this Tokenizer.
    • Constructor Detail

      • Tokenizer

        protected Tokenizer()
        Construct a tokenizer with no input, awaiting a call to setReader(java.io.Reader) to provide input.
    • Method Detail

      • close

        public void close()
                   throws IOException
        Releases resources associated with this stream.

        If you override this method, always call super.close(), otherwise some internal state will not be correctly reset (e.g., Tokenizer will throw IllegalStateException on reuse).

        NOTE: The default implementation closes the input Reader, so be sure to call super.close() when overriding this method.

        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Overrides:
        close in class TokenStream
        Throws:
        IOException
      • setReader

        public final void setReader​(Reader input)
        Expert: Set a new reader on the Tokenizer. Typically, an analyzer (in its tokenStream method) will use this to re-use a previously created tokenizer.
      • reset

        public void reset()
                   throws IOException
        Description copied from class: TokenStream
        This method is called by a consumer before it begins consumption using TokenStream.incrementToken().

        Resets this stream to a clean state. Stateful implementations must implement this method so that they can be reused, just as if they had been created fresh.

        If you override this method, always call super.reset(), otherwise some internal state will not be correctly reset (e.g., Tokenizer will throw IllegalStateException on further usage).

        Overrides:
        reset in class TokenStream
        Throws:
        IOException
      • setReaderTestPoint

        protected void setReaderTestPoint()
        NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.