|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttcl.lang.process.TclProcess
tcl.lang.process.JavaProcess
public class JavaProcess
Implements a pure Java process. Combines java.lang.ProcessBuilder and java.lang.Process. Has the disadvantage of possibly sucking up too much stdin, and cannot outlive the JVM if it has any PIPE or CHANNEL or INHERIT redirects. When Java 1.7 is available, this class should be re-written to do a proper INHERIT redirect, instead of using the pipe model of Java 1.5, to avoid sucking up too much stdin.
Field Summary | |
---|---|
protected Process |
process
The Java Process object |
protected ProcessBuilder |
processBuilder
The Java ProcessBuilder object |
protected tcl.lang.process.JavaProcess.Coupler |
stderrCoupler
Coupler that reads this process's stderr |
protected OutputStream |
stderrStream
The sink for this process's stderr |
protected InputStream |
stdinStream
The source of bytes for this process's stdin |
protected tcl.lang.process.JavaProcess.Coupler |
stdoutCoupler
Coupler that reads this process's stdout |
protected OutputStream |
stdoutStream
The sink for this process's stdout |
Fields inherited from class tcl.lang.process.TclProcess |
---|
command, interp, savedException, stderrRedirect, stdinRedirect, stdoutRedirect |
Constructor Summary | |
---|---|
JavaProcess()
|
Method Summary | |
---|---|
boolean |
canInheritFileDescriptors()
|
void |
destroy()
Kill the running process |
int |
exitValue()
|
InputStream |
getErrorStream()
|
InputStream |
getInputStream()
|
OutputStream |
getOutputStream()
|
int |
getPid()
|
protected int |
implWaitFor()
Platform-specific wait for the process to complete |
boolean |
isStarted()
|
void |
setWorkingDir(File workingDir)
|
void |
start()
Start the process executing, and register streams with any STREAM redirects |
Methods inherited from class tcl.lang.process.TclProcess |
---|
command, getenv, getStderrRedirect, getStdinRedirect, getStdoutRedirect, newInstance, saveIOException, setCommand, setStderrRedirect, setStdinRedirect, setStdoutRedirect, throwAnyExceptions, waitFor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Process process
protected ProcessBuilder processBuilder
protected InputStream stdinStream
protected OutputStream stdoutStream
protected OutputStream stderrStream
protected tcl.lang.process.JavaProcess.Coupler stdoutCoupler
protected tcl.lang.process.JavaProcess.Coupler stderrCoupler
Constructor Detail |
---|
public JavaProcess()
Method Detail |
---|
public OutputStream getOutputStream()
public InputStream getInputStream()
public InputStream getErrorStream()
public int exitValue() throws IllegalThreadStateException
exitValue
in class TclProcess
IllegalThreadStateException
- if the process has not yet completedpublic void start() throws IOException
TclProcess
start
in class TclProcess
IOException
protected int implWaitFor() throws InterruptedException, IOException
TclProcess
implWaitFor
in class TclProcess
InterruptedException
- if the process is interrupted
IOException
public int getPid() throws IllegalThreadStateException
getPid
in class TclProcess
IllegalThreadStateException
- if the process has not yet startedpublic boolean isStarted()
isStarted
in class TclProcess
public void setWorkingDir(File workingDir)
setWorkingDir
in class TclProcess
workingDir
- Directory the process starts inpublic void destroy()
TclProcess
destroy
in class TclProcess
public boolean canInheritFileDescriptors()
canInheritFileDescriptors
in class TclProcess
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |