|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Process
edu.rice.cs.util.ProcessChain
public class ProcessChain
This class represents a piping chain of processes, in which the output of the first process is piped into the input of the second process, and so on. The class allows the entire chain to be treated as if it were just one process. The constructor also sets up the input and output streams of the individual processes so they can function as a chain.
Nested Class Summary | |
---|---|
protected class |
ProcessChain.ProcessChainThreadGroup
Thread group for all threads that deal with this process sequence. |
Field Summary | |
---|---|
protected boolean |
_aborted
True when execution of this chain has been aborted. |
protected PipedInputStream |
_combinedErrorStream
The combined error stream of all processes. |
protected JoinInputStream |
_combinedInputJoinedWithDebugStream
The combined input stream of all the processes, plus a debug stream. |
protected PipedInputStream |
_combinedInputStream
The combined input stream of all processes. |
protected PipedOutputStream |
_combinedStdErrStream
The stream into which all outputs to stderr are written. |
protected PipedOutputStream |
_combinedStdOutStream
The stream into which all outputs to stdout are written. |
protected ProcessCreator[] |
_creators
The process creators that create the processes in this process chain. |
protected PipedInputStream |
_debugInputStream
Debug input and output stream. |
protected PrintWriter |
_debugOutput
Debug output that gets joined with the streams from the processes. |
protected PipedOutputStream |
_debugOutputStream
|
protected Process[] |
_processes
The processes inside this piping chain. |
protected Set<StreamRedirectThread> |
_redirectors
The redirector threads that move output (both stdout and stderr) from one process to the input of the next process. |
static String |
PIPE_SEPARATOR
Separator used between processes inside the same process chain. |
static char |
PIPE_SEPARATOR_CHAR
Separator used between processes inside the same process chain. |
static String |
PROCESS_SEPARATOR
Separator used between different process chains. |
static char |
PROCESS_SEPARATOR_CHAR
Separator used between different process chains. |
Constructor Summary | |
---|---|
ProcessChain(ProcessCreator[] pcs)
Constructor for a process chain consisting of the individual processes provided. |
Method Summary | |
---|---|
void |
destroy()
Kills all subprocesses. |
int |
exitValue()
Returns the exit value for the subprocess. |
InputStream |
getErrorStream()
Gets the error stream of the process sequence, i.e. |
InputStream |
getInputStream()
Gets the input stream of the process sequence, i.e. |
OutputStream |
getOutputStream()
Gets the output stream of the process sequence, i.e. |
protected void |
stopAllRedirectors()
Set the stop flags for all redirector threads. |
int |
waitFor()
Causes the current thread to wait, if necessary, until the process chain has terminated, i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char PROCESS_SEPARATOR_CHAR
public static final String PROCESS_SEPARATOR
public static final char PIPE_SEPARATOR_CHAR
public static final String PIPE_SEPARATOR
protected ProcessCreator[] _creators
protected Process[] _processes
protected boolean _aborted
protected Set<StreamRedirectThread> _redirectors
protected PipedInputStream _combinedInputStream
protected PipedOutputStream _combinedStdOutStream
protected JoinInputStream _combinedInputJoinedWithDebugStream
protected PrintWriter _debugOutput
protected PipedInputStream _debugInputStream
protected PipedOutputStream _debugOutputStream
protected PipedInputStream _combinedErrorStream
protected PipedOutputStream _combinedStdErrStream
Constructor Detail |
---|
public ProcessChain(ProcessCreator[] pcs)
pcs
- array of ProcessCreatorsMethod Detail |
---|
public OutputStream getOutputStream()
getOutputStream
in class Process
public InputStream getErrorStream()
getErrorStream
in class Process
public InputStream getInputStream()
getInputStream
in class Process
public int waitFor() throws InterruptedException
waitFor
in class Process
InterruptedException
- if the current thread is
interrupted
by another thread
while it is waiting, then the wait is ended and an
InterruptedException
is thrown.public int exitValue()
exitValue
in class Process
Process
object. by convention, the value
0
indicates normal termination.
IllegalThreadStateException
- if the subprocess represented
by this Process
object has not yet terminated.public void destroy()
ProcessChain
object is forcibly terminated.
destroy
in class Process
protected void stopAllRedirectors()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |