com.jalios.io
Class StreamGobbler

java.lang.Object
  extended by 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 Summary
StreamGobbler(String name, InputStream in)
          Constructs a new StreamGobbler.
StreamGobbler(String name, InputStream in, OutputStream out)
          Constructs a new StreamGobbler which dump the input stream in an OuputStream.
StreamGobbler(String name, InputStream in, StringBuilder sb)
          Constructs a new StreamGobbler which dump the input stream to a StringBuilder
 
Method Summary
 String getString()
           
 void run()
           
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

start

public void start()

run

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

getString

public String getString()


Copyright © 2001-2010 Jalios SA. All Rights Reserved.