|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.CommandLine
public class CommandLine
Supports the execution of commands as they would work in a bash shell
environment. This is different from using Runtime: multiple commands
can be issued, and environment variables can be set. Also, input and output
streams can be used. Can easily be extended to emulate other shells.
| Field Summary | |
|---|---|
static java.lang.String[] |
DEFAULT_SHELL_COMMAND
Default behaviour is to invoke a bash shell just as if it were a login shell, ready to accept commands. |
| Constructor Summary | |
|---|---|
CommandLine()
Default constructor. |
|
CommandLine(java.lang.String[] shellCommand)
Constructs a command line and invokes the given shell commands, specified as a String array. |
|
| Method Summary | |
|---|---|
void |
exec(java.lang.String command)
Executes the given command, interpreted just as if it were typed into a bash shell. |
void |
exec(java.lang.String[] cmdArray)
Executes an array of commands by concatenating them into a single command. |
java.lang.String |
getError()
Returns the buffered error output of this process. |
java.io.InputStream |
getInputStream()
Returns the input stream of this process. |
java.lang.String |
getOutput()
Returns the buffered output of this process. |
java.io.OutputStream |
getOutputStream()
Returns the output stream of this process. |
static void |
main(java.lang.String[] args)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String[] DEFAULT_SHELL_COMMAND
| Constructor Detail |
|---|
public CommandLine()
public CommandLine(java.lang.String[] shellCommand)
shellCommand - the set of desired shell commands.| Method Detail |
|---|
public static void main(java.lang.String[] args)
public void exec(java.lang.String command)
command - the desired command.public void exec(java.lang.String[] cmdArray)
cmdArray - the given array of commands.public java.lang.String getError()
public java.io.InputStream getInputStream()
public java.lang.String getOutput()
public java.io.OutputStream getOutputStream()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||