consciouscode.util
Class ProcessRunner
java.lang.Object
consciouscode.util.ProcessRunner
- Direct Known Subclasses:
- VmForker
public class ProcessRunner
- extends Object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INTERRUPTED
public static final int INTERRUPTED
- See Also:
- Constant Field Values
DEFAULT_PROCESS_TAG
public static final String DEFAULT_PROCESS_TAG
- See Also:
- Constant Field Values
ProcessRunner
public ProcessRunner(String[] command)
ProcessRunner
public ProcessRunner(String[] command,
String processTag)
getCommand
public String[] getCommand()
- Gets the command line that is used for the child process. Subclasses
can override this method to compute the command line dynamically.
getProcessTag
public String getProcessTag()
setProcessTag
public void setProcessTag(String tag)
getDestroyOnShutdown
public boolean getDestroyOnShutdown()
- Indicate whether the forked
Process
will be destroyed when this
JVM is shut down. The value can be changed even after the process has
been forked.
By default, this property is true.
setDestroyOnShutdown
public void setDestroyOnShutdown(boolean destroy)
setStdOut
public void setStdOut(Writer writer)
setStdErr
public void setStdErr(Writer writer)
fork
public void fork()
throws IOException
- Fork a new process.
PRECONDITION: ! isRunning()
- Throws:
IOException
- if an I/O error occurs while forking the process.
isProcessRunning
public boolean isProcessRunning()
getProcessStdIn
public OutputStream getProcessStdIn()
- Gets a stream connected to the standard input stream of the running
process.
- Returns:
- an output steam that can be used to send input to the child
process, or
null
if the process is not running.
getProcessExitValue
public int getProcessExitValue()
waitForExit
public void waitForExit()
destroy
public void destroy()
Copyright © 2001–2012
Todd V. Jonker. All Rights Reserved.