|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.emory.mathcs.util.natives.ExecUtils
Utility methods to interact with and manage native processes started from Java.
Nested Class Summary | |
static interface |
ExecUtils.BrokenPipeHandler
User-specified IO exception handler for exceptions during I/O redirection. |
static class |
ExecUtils.CmdResult
Represents the result of a native command. |
static interface |
ExecUtils.ProcessExitHandler
User-specified handler invoked when associated native process exits. |
Method Summary | |
static ExecUtils.CmdResult |
execCommand(java.lang.Process process)
Attach to the specified process and return its results. |
static ExecUtils.CmdResult |
execCommand(java.lang.Process process,
java.io.InputStream stdin)
Attach to the specified process, feed specified standard input, and return process' results. |
static ExecUtils.CmdResult |
execCommand(java.lang.String cmd)
Execute specified command and return its results. |
static void |
handleProcess(java.lang.Process process,
java.io.InputStream stdin,
boolean inAutoFlush,
boolean inAutoClose,
ExecUtils.BrokenPipeHandler inBrokenHandler,
java.io.OutputStream stdout,
boolean outAutoFlush,
boolean outAutoClose,
ExecUtils.BrokenPipeHandler outBrokenHandler,
java.io.OutputStream stderr,
boolean errAutoFlush,
boolean errAutoClose,
ExecUtils.BrokenPipeHandler errBrokenHandler,
ExecUtils.ProcessExitHandler exitHandler)
|
static void |
handleProcess(java.lang.Process process,
java.io.InputStream stdin,
java.io.OutputStream stdout,
java.io.OutputStream stderr)
|
static void |
handleProcess(java.lang.Process process,
java.io.InputStream stdin,
java.io.OutputStream stdout,
java.io.OutputStream stderr,
boolean autoFlush,
boolean autoClose,
ExecUtils.BrokenPipeHandler brokenPipeHandler,
ExecUtils.ProcessExitHandler exitHandler)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static ExecUtils.CmdResult execCommand(java.lang.String cmd) throws java.io.IOException, java.lang.InterruptedException
System.out.println(ExecUtils.execCommand("/bin/ls").getOut());
cmd
- the command to execute
java.io.IOException
- if an I/O error occurs
java.lang.InterruptedException
- if thread is interrupted before command
completespublic static ExecUtils.CmdResult execCommand(java.lang.Process process) throws java.io.IOException, java.lang.InterruptedException
Process p = runtime.exec("/bin/ls"); System.out.println(ExecUtils.execCommand(p).getOut());
process
- the process to attach to
java.io.IOException
- if an I/O error occurs
java.lang.InterruptedException
- if thread is interrupted before process
endspublic static ExecUtils.CmdResult execCommand(java.lang.Process process, java.io.InputStream stdin) throws java.io.IOException, java.lang.InterruptedException
process
- the process to attach tostdin
- the data to redirect to process' standard input
java.io.IOException
- if an I/O error occurs
java.lang.InterruptedException
- if thread is interrupted before process
endsexecCommand(Process)
public static void handleProcess(java.lang.Process process, java.io.InputStream stdin, java.io.OutputStream stdout, java.io.OutputStream stderr) throws java.io.IOException
java.io.IOException
public static void handleProcess(java.lang.Process process, java.io.InputStream stdin, java.io.OutputStream stdout, java.io.OutputStream stderr, boolean autoFlush, boolean autoClose, ExecUtils.BrokenPipeHandler brokenPipeHandler, ExecUtils.ProcessExitHandler exitHandler) throws java.io.IOException
java.io.IOException
public static void handleProcess(java.lang.Process process, java.io.InputStream stdin, boolean inAutoFlush, boolean inAutoClose, ExecUtils.BrokenPipeHandler inBrokenHandler, java.io.OutputStream stdout, boolean outAutoFlush, boolean outAutoClose, ExecUtils.BrokenPipeHandler outBrokenHandler, java.io.OutputStream stderr, boolean errAutoFlush, boolean errAutoClose, ExecUtils.BrokenPipeHandler errBrokenHandler, ExecUtils.ProcessExitHandler exitHandler) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |