Class Analyzer.TokenStreamComponents

  • Enclosing class:
    Analyzer

    public static final class Analyzer.TokenStreamComponents
    extends java.lang.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 Detail

      • source

        protected final java.util.function.Consumer<java.io.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​(java.util.function.Consumer<java.io.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
    • Method Detail

      • setReader

        private void setReader​(java.io.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
      • getSource

        public java.util.function.Consumer<java.io.Reader> getSource()
        Returns the component's source