Package org.apache.lucene.analysis

## Class Analyzer.TokenStreamComponents

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

- Enclosing class:
    Analyzer

      public static final class Analyzer.TokenStreamComponents
      extends Object

  This class encapsulates the outer components of a token stream. It provides access to the source (a `Reader` `Consumer` 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 | Description
    --- | --- | ---
    `protected TokenStream` | `sink` | Sink tokenstream, such as the outer tokenfilter decorating the chain.
    `protected Consumer<Reader>` | `source` | Original source of the tokens.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TokenStreamComponents​(Consumer<Reader> source, TokenStream result)` | Creates a new `Analyzer.TokenStreamComponents` instance.
    `TokenStreamComponents​(Tokenizer tokenizer)` | Creates a new `Analyzer.TokenStreamComponents` from a Tokenizer
    `TokenStreamComponents​(Tokenizer tokenizer, TokenStream result)` | Creates a new `Analyzer.TokenStreamComponents` instance

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Consumer<Reader>` | `getSource()` | Returns the component's source
    `TokenStream` | `getTokenStream()` | Returns the sink `TokenStream`

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

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

- - ### Field Detail

    - #### source

          protected final Consumer<Reader> 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​(Consumer<Reader> source,
                                       TokenStream result)

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

    - #### TokenStreamComponents

          public TokenStreamComponents​(Tokenizer tokenizer,
                                       TokenStream result)

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

    - #### TokenStreamComponents

          public TokenStreamComponents​(Tokenizer tokenizer)

      Creates a new `Analyzer.TokenStreamComponents` from a Tokenizer

  - ### Method Detail

    - #### getTokenStream

          public TokenStream getTokenStream()

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

    - #### getSource

          public Consumer<Reader> getSource()

      Returns the component's source