Class OutputCollector

java.lang.Object
org.fife.rsta.ac.OutputCollector
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
PerlOutputCollector

public class OutputCollector extends Object implements Runnable
A class that eats the stdout or stderr of a running Process to prevent deadlock.
Version:
1.0
  • Field Details

  • Constructor Details

    • OutputCollector

      public OutputCollector(InputStream in)
      Constructor.
      Parameters:
      in - The input stream.
    • OutputCollector

      public OutputCollector(InputStream in, StringBuilder sb)
      Constructor.
      Parameters:
      in - The input stream.
      sb - The buffer in which to collect the output.
    • OutputCollector

      public OutputCollector(InputStream in, boolean collect)
      Constructor.
      Parameters:
      in - The input stream.
      collect - Whether to actually collect the output in a buffer. If this is false, then getOutput() will return null. This parameter can be used if you want to eat, but ignore, stdout or stderr for a process.
  • Method Details

    • getOutput

      public StringBuilder getOutput()
      Returns the output collected from the stream.
      Returns:
      The output.
    • handleLineRead

      protected void handleLineRead(String line)
      Called every time a line is read from the stream. This allows subclasses to handle lines differently. They can also call into the super implementation if they want to log the lines into the buffer.
      Parameters:
      line - The line read.
    • run

      public void run()
      Specified by:
      run in interface Runnable