public class ShellProcess extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
closeStderr() |
void |
closeStdin() |
void |
closeStdout() |
void |
destroy()
Kills the subprocess.
|
int |
exitValue()
Returns the exit value for the subprocess.
|
boolean |
getIsDone()
Returns true if the process is done, false if not
|
String |
readChar() |
String |
readLine()
Reads a line of text from stdout.
|
String |
readStderrLine()
Reads a line of text from stderr.
|
String |
readStderrUntil(char character,
boolean includeDeliminator)
Reads a group of text from stderr.
|
String |
readUntil(String character,
boolean includeDeliminator)
Reads a group of text from stdout.
|
int |
waitFor()
Causes the current thread to wait, if necessary, until the
process represented by this
Process object has
terminated. |
void |
write(String text)
Writes the specified text to stdin
|
public String readLine()
public String readUntil(String character, boolean includeDeliminator)
character - the character to read untilincludeDeliminator - true to include the deliminator in the returned text, false to not.public String readChar()
public String readStderrLine()
public String readStderrUntil(char character, boolean includeDeliminator)
character - the character to read untilincludeDeliminator - true to include the deliminator in the returned text, false to not.public void write(String text)
text - the text to writepublic void closeStdout()
public void closeStderr()
public void closeStdin()
public int waitFor()
throws InterruptedException
Process object has
terminated. This method returns
immediately if the subprocess has already terminated. If the
subprocess has not yet terminated, the calling thread will be
blocked until the subprocess exits.0 indicates normal termination.InterruptedException - if the current thread is
interrupted by another thread
while it is waiting, then the wait is ended and an
InterruptedException is thrown.public int exitValue()
Process object. by convention, the value
0 indicates normal termination.IllegalThreadStateException - if the subprocess represented
by this Process object has not yet terminated.public boolean getIsDone()
public void destroy()
Process object is forcibly terminated.Copyright © 2019. All rights reserved.