|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpop.io.IOControl
Controls the I/O for a process. When using the std[in|out|err] streams, they must all be put on different threads to avoid blocking!
Constructor Summary | |
IOControl(java.lang.Process process)
Constructor for the IOControl object |
Method Summary | |
java.lang.Process |
getProcess()
Gets the process attribute of the IOControl object. |
java.io.BufferedReader |
getStderr()
Gets the stderr attribute of the IOControl object |
java.io.PrintStream |
getStdin()
Gets the stdin attribute of the IOControl object |
java.io.BufferedReader |
getStdout()
Gets the stdout attribute of the IOControl object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public IOControl(java.lang.Process process)
process
- The process to control I/O forMethod Detail |
public java.io.PrintStream getStdin()
public java.io.BufferedReader getStdout()
public java.io.BufferedReader getStderr()
public java.lang.Process getProcess()
. IOControl ioc; . . new Thread(){ . public void run(){ . while(true){ // only necessary if you want the process to respawn . try{ . ioc = new IOControl(Runtime.getRuntime().exec("procname")); . // add some code to handle the IO streams . ioc.getProcess().waitFor(); . }catch(InterruptedException ie){ . // deal with exception . }catch(IOException ioe){ . // deal with exception . } . . // a break condition can be included here to terminate the loop . } // only necessary if you want the process to respawn . } . }.start();
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |