|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.tests.session.ProcessController
public class ProcessController
Executes an external process synchronously, allowing the client to define a maximum amount of time for the process to complete.
Nested Class Summary | |
---|---|
class |
ProcessController.TimeOutException
Thrown when a process being executed exceeds the maximum amount of time allowed for it to complete. |
Constructor Summary | |
---|---|
ProcessController(long timeout,
java.lang.String[] params)
Constructs an instance of ProcessController. |
Method Summary | |
---|---|
int |
execute()
Causes the process to start executing. |
void |
forwardErrorOutput(java.io.OutputStream err)
Forwards the process standard error output to the given output stream. |
void |
forwardInput(java.io.InputStream in)
Forwards the given input stream to the process standard input. |
void |
forwardOutput(java.io.OutputStream out)
Forwards the process standard output to the given output stream. |
java.lang.Process |
getProcess()
Returns the controled process. |
void |
kill()
Kills the process. |
boolean |
wasKilled()
Returns whether the process was killed due to a time out. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProcessController(long timeout, java.lang.String[] params)
run()
does that.
timeout
- the maximum time the process should take to runparams
- the parameters to be passed to the controlled processMethod Detail |
---|
public int execute() throws java.lang.InterruptedException, java.io.IOException, ProcessController.TimeOutException
timeout
is specified, the
process will be interrupted if it takes more than the specified amount
of time to complete, causing a TimedOutException
to be thrown.
Specifying zero as timeout
means
the process is not time constrained.
java.lang.InterruptedException
java.io.IOException
ProcessController.TimeOutException
- if the process did not complete in timepublic void forwardErrorOutput(java.io.OutputStream err)
err
- an output stream where to forward the process
standard error output topublic void forwardOutput(java.io.OutputStream out)
out
- an output stream where to forward the process
standard output topublic java.lang.Process getProcess()
null
before
execute
is called.
public void kill()
public boolean wasKilled()
true
if the process was killed,
false
if the completed normallypublic void forwardInput(java.io.InputStream in)
in
- an input stream where the process
standard input will be forwarded to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |