org.apache.lucene.analysis

## Class Analyzer.TokenStreamComponents

- java.lang.Object
- - org.apache.lucene.analysis.Analyzer.TokenStreamComponents

- Enclosing class:
    Analyzer

      public static class Analyzer.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 of `TokenFilter` which also serves as the `TokenStream` returned by `Analyzer.tokenStream(String, Reader)`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TokenStream` | `sink` Sink tokenstream, such as the outer tokenfilter decorating the chain.
    `protected Tokenizer` | `source` Original source of the tokens.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TokenStreamComponents(Tokenizer source)` Creates a new `Analyzer.TokenStreamComponents` instance.
    `TokenStreamComponents(Tokenizer source, TokenStream result)` Creates a new `Analyzer.TokenStreamComponents` instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Tokenizer` | `getTokenizer()` Returns the component's `Tokenizer`
    `TokenStream` | `getTokenStream()` Returns the sink `TokenStream`
    `protected void` | `setReader(Reader reader)` Resets the encapsulated components with the given reader.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### source

          protected final Tokenizer source

      Original source of the tokens.

    - #### sink

          protected final TokenStream sink

      Sink tokenstream, such as the outer tokenfilter decorating the chain. This can be the source if there are no filters.

  - ### Constructor Detail

    - #### TokenStreamComponents

          public TokenStreamComponents(Tokenizer source,
                                       TokenStream result)

      Creates a new `Analyzer.TokenStreamComponents` instance.
      Parameters:
        `source` - the analyzer's tokenizer
        `result` - the analyzer's resulting token stream

    - #### TokenStreamComponents

          public TokenStreamComponents(Tokenizer source)

      Creates a new `Analyzer.TokenStreamComponents` instance.
      Parameters:
        `source` - the analyzer's tokenizer

  - ### Method Detail

    - #### setReader

          protected void setReader(Reader reader)

      Resets the encapsulated components with the given reader. If the components cannot be reset, an Exception should be thrown.
      Parameters:
        `reader` - a reader to reset the source component

    - #### getTokenStream

          public TokenStream getTokenStream()

      Returns the sink `TokenStream`
      Returns:
        the sink `TokenStream`

    - #### getTokenizer

          public Tokenizer getTokenizer()

      Returns the component's `Tokenizer`
      Returns:
        Component's `Tokenizer`

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