Class AbstractProcessReader

java.lang.Object
com.github.fracpete.processoutput4j.core.AbstractProcessRunnable
com.github.fracpete.processoutput4j.reader.AbstractProcessReader
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
CollectingProcessReader, ConsoleOutputProcessReader, StreamingProcessReader

public abstract class AbstractProcessReader extends AbstractProcessRunnable
Ancestor for readers that read line from stdout/stderr of the provided Process object.
  • Field Details

    • m_Stdout

      protected boolean m_Stdout
      whether to use stdout or stderr.
    • m_Reader

      protected BufferedReader m_Reader
      the reader use internally.
  • Constructor Details

    • AbstractProcessReader

      public AbstractProcessReader(boolean stdout)
      Initializes the reader.
      Parameters:
      stdout - whether to read stdout or stderr
  • Method Details

    • isStdout

      public boolean isStdout()
      Returns whether the reader is for stdout or stderr.
      Returns:
      true if for stdout
    • process

      protected abstract void process(String line)
      For processing the line read from stdout/stderr.
      Parameters:
      line - the output line
    • flush

      public void flush()
      Flushes the data.
    • doRun

      protected void doRun()
      The actual processing loop.
      Specified by:
      doRun in class AbstractProcessRunnable