|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.uima.pear.util.ProcessUtil.Runner
public static class ProcessUtil.Runner
The ProcessUtil.Runner
class allows collecting, printing and distributing
console output (stdout and stderr) of the specified Process
without blocking the
caller. It allows adding standard stream listeners to receive messages printed to the console
by selected process.
Constructor Summary | |
---|---|
ProcessUtil.Runner(Process aProcess)
Constructor that takes a given Process object and assigns default process
name. |
|
ProcessUtil.Runner(Process aProcess,
String procName)
Constructor that takes a given Process object and a given process name. |
|
ProcessUtil.Runner(Process aProcess,
String procName,
boolean printToConsole)
Constructor that takes a given Process object, a given process name, and a
given boolean flag that enables/disables console printing. |
Method Summary | |
---|---|
void |
addStreamListener(ProcessUtil.StdStreamListener listener)
Adds a given object, implementing the StdStreamListener interface to the list
of standard stream listeners. |
String |
getErrOutput()
|
int |
getExitCode()
|
Process |
getProcess()
|
String |
getStdOutput()
|
void |
removeListener(ProcessUtil.StdStreamListener listener)
Removes a given StdStreamListener object from the list of standard stream
listeners. |
void |
run()
Implements the Runnable.run() method, collecting and printing standard output
or standard error messages during the process execution. |
int |
waitFor()
Allows the caller to wait for the completion of the process. |
int |
waitFor(long timeout)
Allows the caller to wait for the completion of the process, but no longer than a given timeout value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProcessUtil.Runner(Process aProcess)
Process
object and assigns default process
name.
aProcess
- The given Process
object.public ProcessUtil.Runner(Process aProcess, String procName)
Process
object and a given process name.
aProcess
- The given Process
object.procName
- The given process name.public ProcessUtil.Runner(Process aProcess, String procName, boolean printToConsole)
Process
object, a given process name, and a
given boolean
flag that enables/disables console printing. If the given
process name is null
, the default process name is assigned.
aProcess
- The given Process
object.procName
- The given process name.printToConsole
- boolean
flag that enables/disables console printing.Method Detail |
---|
public void addStreamListener(ProcessUtil.StdStreamListener listener)
StdStreamListener
interface to the list
of standard stream listeners. Sends to the new listener previously printed standard error and
standard output messages.
listener
- The given new standard stream listener.public int getExitCode()
Integer.MAX_VALUE
.public String getErrOutput()
public Process getProcess()
public String getStdOutput()
public void removeListener(ProcessUtil.StdStreamListener listener)
StdStreamListener
object from the list of standard stream
listeners.
listener
- The given StdStreamListener
object to be removed from the list.public void run()
Runnable.run()
method, collecting and printing standard output
or standard error messages during the process execution.
run
in interface Runnable
public int waitFor()
public int waitFor(long timeout)
timeout
- The given timeout value (ms).
Integer.MAX_VALUE
, if the process has not
finished yet.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |