|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gate.util.ProcessManager
public class ProcessManager
Class that supports running an external process and either silently consuming its standard output and error streams, or copying them to Java's stdout and stderr. This implementation reads the output and error streams in separate threads, but tries to reuse these threads from one external call to the next, unlike other approaches I've seen (which all spawn a pair of new threads for every external call). As a result, instances of this class are not thread safe. You must use a different instance of ProcessManager in each thread that you use to run external processes.
Constructor Summary | |
---|---|
ProcessManager()
Construct a ProcessManager object and start the gobbler threads. |
Method Summary | |
---|---|
int |
runProcess(String[] argv,
boolean dumpOutput)
Run the given external process. |
int |
runProcess(String[] argv,
File dir,
OutputStream out,
OutputStream err)
Run the given external process. |
int |
runProcess(String[] argv,
OutputStream out,
OutputStream err)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProcessManager()
Method Detail |
---|
public int runProcess(String[] argv, boolean dumpOutput) throws IOException
argv
- the process command line, suitable for passing to
Runtime.exec
.dumpOutput
- should we copy the process output and error streams to
the Java output and error streams or just consume them silently?
IOException
public int runProcess(String[] argv, OutputStream out, OutputStream err) throws IOException
IOException
public int runProcess(String[] argv, File dir, OutputStream out, OutputStream err) throws IOException
argv
- the process command line, suitable for passing to
Runtime.exec
.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |