|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.util.ShellCommand
public class ShellCommand
Passes a command to the OS shell for execution and manages the input and output.
This class must be kept gcj
-compatible.
Constructor Summary | |
---|---|
ShellCommand()
|
Method Summary | |
---|---|
void |
execute(String shellCommand)
Deprecated. unused |
boolean |
executeAndWait(String shellCommand)
Deprecated. unused |
boolean |
executeAndWaitTimed(String shellCommand,
int seconds)
Deprecated. unused |
void |
executeSilent(String shellCommand)
Deprecated. unused |
boolean |
executeSilentAndWait(String shellCommand)
Passes a command to the shell for execution. |
boolean |
executeSilentAndWaitTimed(String[] commandArray,
int seconds)
Passes a command to the shell for execution. |
boolean |
executeSilentAndWaitTimed(String shellCommand,
int seconds)
Passes a command to the shell for execution. |
InputStream |
getErrorStream()
|
InputStream |
getInputStream()
|
OutputStream |
getOutputStream()
|
static void |
main(String[] args)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShellCommand()
Method Detail |
---|
public void execute(String shellCommand)
STDOUT
and STDERR
as appropriate, and can be read via getOutputStream()
and
getErrorStream()
, respectively. Input can be passed to the
STDIN
of the shell process via getInputStream()
.
Warning, no good way to quote or escape spaces in arguments with this method.
shellCommand
- The command for the shell to execute.public boolean executeAndWait(String shellCommand)
STDOUT
and
STDERR
as appropriate, and can be read via
getOutputStream()
and getErrorStream()
, respectively.
Input can be passed to the STDIN
of the shell process via
getInputStream()
.
Warning, no good way to quote or escape spaces in arguments with this method.
shellCommand
- The command for the shell to execute.
true
if the spawned shell process
returns an exit status of 0 (indicating success),
else false
.public boolean executeAndWaitTimed(String shellCommand, int seconds)
STDOUT
and STDERR
as appropriate, and can be read via getOutputStream()
and
getErrorStream()
, respectively. Input can be passed to the
STDIN
of the shell process via getInputStream()
.
Warning, no good way to quote or escape spaces in arguments with this method.
shellCommand
- The command for the shell to execute.seconds
- The method will return true
if this
number of seconds elapses without the process
returning an exit status. A value of 0
here disables waiting.
true
if the spawned shell process
returns an exit status of 0 (indicating success),
else false
.public void executeSilent(String shellCommand) throws IOException
shellCommand
- The command for the shell to execute.
IOException
public boolean executeSilentAndWait(String shellCommand)
shellCommand
- The command for the shell to execute.
true
if the spawned shell process
returns an exit status of 0 (indicating success),
else false
.public boolean executeSilentAndWaitTimed(String shellCommand, int seconds)
shellCommand
- The command for the shell to execute, as a String.
You can't quote arguments successfully.
See Runtime.exec(String) for more info.seconds
- The method will return true
if this
number of seconds elapses without the process
returning an exit status. A value of 0
here disables waiting.
true
if the spawned shell process
returns an exit status of 0 (indicating success),
else false
.public boolean executeSilentAndWaitTimed(String[] commandArray, int seconds)
commandArray
- The command for the shell to execute,
as a String[].
See Runtime.exec(String[]) for more info.seconds
- The method will return true
if this
number of seconds elapses without the process
returning an exit status. A value of 0
here disables waiting.
true
if the spawned shell process
returns an exit status of 0 (indicating success),
else false
.public InputStream getErrorStream()
public InputStream getInputStream()
public OutputStream getOutputStream()
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |