|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.util.ExternalProcess
public class ExternalProcess
A utility class allowing UNIX process I/O. Because most of these methods are system dependent, applications should first confirm that the OS supports ksh scripting.
The commandLine(String) method uses a simple Runtime request,
not the ksh approach.
| Field Summary | |
|---|---|
static int |
SPAWN
Variable used by getProcessOutput to designating that the process should be spawned, but not to wait for output. |
static int |
STDBOTH
Variable used by getProcessOutput to designate process output from a concatenation of UNIX stdout and stderr. |
static int |
STDERR
Variable used by getProcessOutput to designate process output from UNIX stderr. |
static int |
STDOUT
Variable used by getProcessOutput to designate process output from UNIX stdout. |
| Constructor Summary | |
|---|---|
ExternalProcess()
Constructor with an MessageHandler mh. |
|
| Method Summary | |
|---|---|
void |
commandLine(String s)
Runs an application on the String s as if it had been typed on the command line. |
void |
destroy()
Runs an application on the String s as if it had been typed on the command line. |
StringBuffer |
getStderr()
Returns the result of the last commandLine() request's stderr as a StringBuffer, null if unavailable or empty. |
StringBuffer |
getStdout()
Returns the result of the last commandLine() request's stdout as a StringBuffer, null if unavailable or empty. |
protected void |
interpret(String cmd)
Run a process on the host system from within a shell script, returning the results to the defined output streams. |
void |
printResult(Iterator it)
Writes to the MessageHandler the contents of the Iterator it. |
Iterator |
process(String cmd,
int mode)
Runs the program 'cmd' as a UNIX process, then returns the stderr and/or stdout as a Vector, depending on mode, which can be STDBOTH (writes to both streams), STDERR (writes to stderr), or STDOUT (writes to stdout). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int STDOUT
public static int STDERR
public static int STDBOTH
public static int SPAWN
| Constructor Detail |
|---|
public ExternalProcess()
| Method Detail |
|---|
public Iterator process(String cmd,
int mode)
Does not add blank lines to Vector.
public void destroy()
public void commandLine(String s)
getStdout() and getStderr().
public StringBuffer getStdout()
public StringBuffer getStderr()
protected void interpret(String cmd)
throws IOException
IOExceptionpublic void printResult(Iterator it)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||