Package com.jalios.io

Class StreamGobbler

java.lang.Object
com.jalios.io.StreamGobbler
All Implemented Interfaces:
Runnable

public class StreamGobbler extends Object implements Runnable
Class required for process execution to prevent process hang if out/err of program is not read in a seperated thread. http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Since:
jcms-6.1.2
  • Constructor Details

    • StreamGobbler

      public StreamGobbler(String name, InputStream in)
      Constructs a new StreamGobbler.
      Parameters:
      name - the name (for the thread)
      in - the input stream
    • StreamGobbler

      public StreamGobbler(String name, InputStream in, StringBuilder sb)
      Constructs a new StreamGobbler which dump the input stream to a StringBuilder
      Parameters:
      name - the name (for the thread)
      in - the input stream
      sb - the StringBuilder
    • StreamGobbler

      public StreamGobbler(String name, InputStream in, OutputStream out)
      Constructs a new StreamGobbler which dump the input stream in an OuputStream.
      Parameters:
      name - the name (for the thread)
      in - the input stream
      out - the OutputStream
  • Method Details

    • start

      public void start()
    • run

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

      public String getString()