Class OutputReader


  • public abstract class OutputReader
    extends Object
    This class is used to read an input stream and process ouput.
    • Constructor Detail

      • OutputReader

        public OutputReader​(InputStream stream)
        The protected constructor.

        The stream is consumed until end of stream and then closed by this reader's thread, which is only launched by start(). Wrapping the stream is done by that thread as well, so that this reader is the sole owner of every resource built on top of the stream.

        Parameters:
        stream - the output stream of the process to read.
    • Method Detail

      • processLine

        public abstract void processLine​(String line)
        Called whenever new input is read from the reader.
        Parameters:
        line - String representing new input
      • start

        public OutputReader start()
        Starts consuming the reader in a background thread.

        The thread is not started by the constructor so that this does not escape before construction of the subclass has completed.

        Returns:
        this reader