public class StringBufferExec extends StreamExec
As an alternative to this class, see
JTextAreaExec, which uses Swing; and
StreamExec, which writes to stderr and stdout.
Sample usage:
List execCommands = new LinkedList();
execCommands.add("date");
execCommands.add("sleep 3");
execCommands.add("date");
execCommands.add("notACommand");
final StringBufferExec exec = new StringBufferExec();
exec.setCommands(execCommands);
exec.start();
Loosely based on Example1.java from http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
See also http://developer.java.sun.com/developer/qow/archive/135/index.jsp and http://jw.itworld.com/javaworld/jw-12-2000/jw-1229-traps.html
JTextAreaExec| Red (cxh) |
| Red (cxh) |
| Modifier and Type | Field and Description |
|---|---|
java.lang.StringBuffer |
buffer
The StringBuffer to which the output is appended.
|
| Constructor and Description |
|---|
StringBufferExec()
Create a StringBufferExec.
|
StringBufferExec(boolean appendToStderrAndStdout)
Create a StringBufferExec and optionally append to stderr
and stdout as the commands are executed.
|
| Modifier and Type | Method and Description |
|---|---|
void |
stderr(java.lang.String text)
Append the text message to the StringBuffer.
|
void |
stdout(java.lang.String text)
Append the text message to the StringBuffer.
|
_setProgressBarMaximum, appendToPath, cancel, clear, getenv, getLastSubprocessReturnCode, getPatternLog, setCommands, setPattern, setWaitForLastSubprocess, setWorkingDirectory, start, updateEnvironment, updateStatusBarpublic java.lang.StringBuffer buffer
public StringBufferExec()
public StringBufferExec(boolean appendToStderrAndStdout)
appendToStderrAndStdout - If true, then as the commands
are executed, the output is append to stderr and stdout.public void stderr(java.lang.String text)
stderr in interface ExecuteCommandsstderr in class StreamExectext - The text to append.public void stdout(java.lang.String text)
stdout in interface ExecuteCommandsstdout in class StreamExectext - The text to append.