|
|||||||||
| Home >> All >> com >> klavergne >> [ process overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.klavergne.process
Class SmartProcess

java.lang.Objectcom.klavergne.process.SmartProcess
- public class SmartProcess
- extends java.lang.Object
This class uses the Runtime and Process classes to
execute the given command from inside the VM.
While testing this I found that the Runtime class works a little
differently than Sun's API documentation says. Their documentation says that
Runtime.exec() creates a subprocess without a console window. This
is true if using java.exe, but if you use javaw.exe it does create a console
window.
- Version:
- 1.0
| Nested Class Summary | |
private class |
SmartProcess.StreamReader
This class handles reading the standard out and standard error streams. |
| Field Summary | |
private java.lang.String |
command
The command to execute. |
private int |
exitStatus
The exit status code of the process. |
private boolean |
handleExceptions
A boolean value indicating whether the process should handle exceptions. |
private SmartProcess.StreamReader |
stderr
The standard error of the command that is executed. |
private SmartProcess.StreamReader |
stdout
The standard output of the command that is executed. |
private boolean |
wait
A boolean value indicating whether the process should wait until complete before returning. |
| Constructor Summary | |
SmartProcess(java.lang.String command)
Creates a new SmartProcess object with the given String as the command. |
|
SmartProcess(java.lang.String aCommand,
boolean aWait)
Creates a new SmartProcess object with the given String as the command. |
|
SmartProcess(java.lang.String aCommand,
boolean aWait,
boolean aHandleExceptions)
Creates a new SmartProcess object with the given String as the command. |
|
| Method Summary | |
java.lang.String |
getCommand()
Returns the command that this process will execute. |
int |
getExitStatus()
Returns the exit status of the process. |
boolean |
getHandleExceptions()
Returns a boolean value indicating whether the process should handle exceptions. |
java.lang.String |
getStandardError()
Returns a String containing the text of the standard error from the process. |
java.lang.String |
getStandardOut()
Returns a String containing the text of the standard output from the process. |
boolean |
getWait()
Returns a boolean value indicating whether the process should wait to finish before returning. |
void |
go()
Executes the command in a new process. |
static void |
main(java.lang.String[] args)
Executes this class with the given commands in separate processes. |
void |
setCommand(java.util.List parameters)
Sets the command that this process will execute. |
void |
setCommand(java.lang.String aCommand)
Sets the command that this process will execute. |
void |
setCommand(java.lang.String[] parameters)
Sets the command that this process will execute. |
void |
setHandleExceptions(boolean aHandleExceptions)
Sets a boolean value indicating whether the process should handle exceptions. |
void |
setWait(boolean aWait)
Sets the boolean value indicating whether the process should wait to finish before returning. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
command
private java.lang.String command
- The command to execute.
handleExceptions
private boolean handleExceptions
- A boolean value indicating whether the process should handle exceptions.
wait
private boolean wait
- A boolean value indicating whether the process should wait until complete before returning.
exitStatus
private int exitStatus
- The exit status code of the process.
stdout
private SmartProcess.StreamReader stdout
- The standard output of the command that is executed.
stderr
private SmartProcess.StreamReader stderr
- The standard error of the command that is executed.
| Constructor Detail |
SmartProcess
public SmartProcess(java.lang.String command)
- Creates a new
SmartProcessobject with the given String as the command.
SmartProcess
public SmartProcess(java.lang.String aCommand, boolean aWait)
- Creates a new
SmartProcessobject with the given String as the command.
SmartProcess
public SmartProcess(java.lang.String aCommand, boolean aWait, boolean aHandleExceptions)
- Creates a new
SmartProcessobject with the given String as the command.
| Method Detail |
getCommand
public java.lang.String getCommand()
- Returns the command that this process will execute.
setCommand
public void setCommand(java.lang.String aCommand)
- Sets the command that this process will execute.
setCommand
public void setCommand(java.lang.String[] parameters)
- Sets the command that this process will execute.
setCommand
public void setCommand(java.util.List parameters)
- Sets the command that this process will execute.
getWait
public boolean getWait()
- Returns a boolean value indicating whether the process should wait to finish
before returning.
setWait
public void setWait(boolean aWait)
- Sets the boolean value indicating whether the process should wait to finish
before returning.
getHandleExceptions
public boolean getHandleExceptions()
- Returns a boolean value indicating whether the process should handle exceptions.
setHandleExceptions
public void setHandleExceptions(boolean aHandleExceptions)
- Sets a boolean value indicating whether the process should handle exceptions.
getExitStatus
public int getExitStatus()
- Returns the exit status of the process.
getStandardError
public java.lang.String getStandardError()
- Returns a String containing the text of the standard error from the process.
getStandardOut
public java.lang.String getStandardOut()
- Returns a String containing the text of the standard output from the process.
go
public void go()
- Executes the command in a new process.
main
public static void main(java.lang.String[] args)
- Executes this class with the given commands in separate processes.
|
|||||||||
| Home >> All >> com >> klavergne >> [ process overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.klavergne.process.SmartProcess