|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.fenyo.gnetwatch.actions.ExternalCommand
public class ExternalCommand
Instances of this class launch and manage processes outside of the JVM.
| Field Summary | |
|---|---|
private java.lang.String[] |
cmdLine
|
private java.lang.String |
directory
|
private java.io.BufferedReader |
errReader
|
private static Log |
log
|
private boolean |
merge
|
private java.lang.Process |
process
|
private java.io.BufferedReader |
reader
|
private java.lang.StringBuffer |
sb
|
| Constructor Summary | |
|---|---|
ExternalCommand(java.lang.String[] cmdLine)
Creates an ExternalCommand instance and saves the command line. |
|
ExternalCommand(java.lang.String[] cmdLine,
boolean merge)
Creates an ExternalCommand instance and saves the command line. |
|
ExternalCommand(java.lang.String[] cmdLine,
boolean merge,
java.lang.String curdir)
|
|
ExternalCommand(java.lang.String[] cmdLine,
java.lang.String directory)
Creates an ExternalCommand instance and saves the command line. |
|
| Method Summary | |
|---|---|
void |
end()
Make sure the underlying file descriptors are closed, to avoid maintening unused resources in an application server JVM for instance. |
void |
fork()
Launches a process but do not wait for its completion. |
private void |
kill()
Kills the process. |
void |
logArgs()
Displays command line arguments. |
private java.lang.String |
readLine(java.io.Reader r)
Reads a line from the process output. |
java.lang.String |
readLineStderr()
Reads one line of the stderr. |
java.lang.String |
readLineStdout()
Reads one line of the stdout. |
java.lang.String |
readStderr()
Reads stderr. |
java.lang.String |
readStdout()
Reads stdout. |
java.lang.String |
readStdoutStderr()
Merges stdout and stderr. |
java.lang.String |
runStdout()
Reads the whole standard output. |
java.lang.String |
runStdoutStderr()
Reads the whole output. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static Log log
private boolean merge
private final java.lang.String[] cmdLine
private final java.lang.String directory
private final java.lang.StringBuffer sb
private java.lang.Process process
private java.io.BufferedReader reader
private java.io.BufferedReader errReader
| Constructor Detail |
|---|
public ExternalCommand(java.lang.String[] cmdLine,
java.lang.String directory)
cmdLine - command line.directory - path to the current directory for the script to be launched.public ExternalCommand(java.lang.String[] cmdLine)
cmdLine - command line.
public ExternalCommand(java.lang.String[] cmdLine,
boolean merge)
cmdLine - command line.merge - merge standard output and standard error.
public ExternalCommand(java.lang.String[] cmdLine,
boolean merge,
java.lang.String curdir)
| Method Detail |
|---|
private java.lang.String readLine(java.io.Reader r)
throws java.io.IOException,
java.lang.InterruptedException
r - reader.
java.io.IOException - IO exception.
java.lang.InterruptedException - exception.
public java.lang.String runStdoutStderr()
throws java.lang.InterruptedException
java.lang.InterruptedException - exception.
public java.lang.String runStdout()
throws java.lang.InterruptedException
java.lang.InterruptedException - interrupted.public void logArgs()
none. -
public void fork()
throws java.io.IOException
none. -
java.io.IOException - i/o exception
public java.lang.String readStdoutStderr()
throws java.io.IOException,
java.lang.InterruptedException
none. -
java.io.IOException - i/o exception java.lang.InterruptedException
public java.lang.String readStdout()
throws java.io.IOException,
java.lang.InterruptedException
none. -
java.io.IOException - i/o exception java.lang.InterruptedException
public java.lang.String readStderr()
throws java.io.IOException,
java.lang.InterruptedException
none. -
java.io.IOException - i/o exception java.lang.InterruptedException
public java.lang.String readLineStdout()
throws java.io.IOException,
java.lang.InterruptedException
none. -
java.io.IOException - i/o exception java.lang.InterruptedException
public java.lang.String readLineStderr()
throws java.io.IOException,
java.lang.InterruptedException
none. -
java.io.IOException - i/o exception java.lang.InterruptedException
public void end()
throws java.io.IOException
none. -
java.io.IOException - error while closing streams.private void kill()
none. -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||