public class ConsoleProcess extends Process
Constructor and Description |
---|
ConsoleProcess()
Creates a new ConsoleProcess.
|
ConsoleProcess(String command)
Creates a new ConsoleProcess.
|
ConsoleProcess(String command,
Hashtable env)
Creates a new ConsoleProcess.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Closes the console connection and releases associated resources.
|
int |
exitValue()
Obtains the most recent ERRORLEVEL (application return value).
|
protected void |
finalize()
Insures that the session is closed before releasing the object.
|
Hashtable |
getEnvironment()
Returns the current console environment as a Hashtable.
|
InputStream |
getErrorStream()
Creates an InputStream from which you can read output to stderr.
|
InputStream |
getInputStream()
Creates an InputStream from which you can read output to stdout.
|
OutputStream |
getOutputStream()
Creates an OutputStream through which you can enter characters to stdin.
|
boolean |
isAlive()
Queries the status of the console connection.
|
boolean |
isPrompted()
Queries the console input status.
|
boolean |
isReady()
Queries the console input status.
|
void |
killProcess()
Closes the console process.
|
int |
waitFor()
Blocks for console exit.
|
void |
waitPrompt()
Blocks until the command process requests input.
|
public ConsoleProcess(String command, Hashtable env)
command
- optional command to be executedenv
- optional console environmentpublic ConsoleProcess(String command)
command
- optional command to be executedpublic ConsoleProcess()
public void destroy()
public void killProcess()
public boolean isAlive()
public boolean isPrompted()
public void waitPrompt()
public boolean isReady()
public int exitValue() throws IllegalThreadStateException
exitValue
in class Process
IllegalThreadStateException
- if the console is not activepublic InputStream getErrorStream()
getErrorStream
in class Process
public InputStream getInputStream()
getInputStream
in class Process
public OutputStream getOutputStream()
getOutputStream
in class Process
public Hashtable getEnvironment()
public int waitFor() throws InterruptedException
waitFor
in class Process
InterruptedException
- if interrupted before exit