mbenson 2004/04/20 15:18:56
Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
PumpStreamHandler.java
Log:
Sync with HEAD
Revision Changes Path
No revision
No revision
1.14.2.5 +57 -4
ant/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
Index: PumpStreamHandler.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java,v
retrieving revision 1.14.2.4
retrieving revision 1.14.2.5
diff -u -r1.14.2.4 -r1.14.2.5
--- PumpStreamHandler.java 9 Mar 2004 17:01:34 -0000 1.14.2.4
+++ PumpStreamHandler.java 20 Apr 2004 22:18:56 -0000 1.14.2.5
@@ -25,8 +25,6 @@
* Copies standard output and error of subprocesses to standard output and
* error of the parent process.
*
- * TODO: standard input of the subprocess is not implemented.
- *
* @since Ant 1.2
*/
public class PumpStreamHandler implements ExecuteStreamHandler {
@@ -39,6 +37,12 @@
private OutputStream err;
private InputStream input;
+ /**
+ * Construct a new <CODE>PumpStreamHandler</CODE>.
+ * @param out the output <CODE>OutputStream</CODE>.
+ * @param err the error <CODE>OutputStream</CODE>.
+ * @param input the input <CODE>InputStream</CODE>.
+ */
public PumpStreamHandler(OutputStream out, OutputStream err,
InputStream input) {
this.out = out;
@@ -46,29 +50,55 @@
this.input = input;
}
+ /**
+ * Construct a new <CODE>PumpStreamHandler</CODE>.
+ * @param out the output <CODE>OutputStream</CODE>.
+ * @param err the error <CODE>OutputStream</CODE>.
+ */
public PumpStreamHandler(OutputStream out, OutputStream err) {
this(out, err, null);
}
+ /**
+ * Construct a new <CODE>PumpStreamHandler</CODE>.
+ * @param outAndErr the output/error <CODE>OutputStream</CODE>.
+ */
public PumpStreamHandler(OutputStream outAndErr) {
this(outAndErr, outAndErr);
}
+ /**
+ * Construct a new <CODE>PumpStreamHandler</CODE>.
+ */
public PumpStreamHandler() {
this(System.out, System.err);
}
+ /**
+ * Set the <CODE>InputStream</CODE> from which to read the
+ * standard output of the process.
+ * @param is the <CODE>InputStream</CODE>.
+ */
public void setProcessOutputStream(InputStream is) {
createProcessOutputPump(is, out);
}
-
+ /**
+ * Set the <CODE>InputStream</CODE> from which to read the
+ * standard error of the process.
+ * @param is the <CODE>InputStream</CODE>.
+ */
public void setProcessErrorStream(InputStream is) {
if (err != null) {
createProcessErrorPump(is, err);
}
}
+ /**
+ * Set the <CODE>OutputStream</CODE> by means of which
+ * input can be sent to the process.
+ * @param os the <CODE>OutputStream</CODE>.
+ */
public void setProcessInputStream(OutputStream os) {
if (input != null) {
inputThread = createPump(input, os, true);
@@ -81,6 +111,9 @@
}
}
+ /**
+ * Start the <CODE>Thread</CODE>s.
+ */
public void start() {
outputThread.start();
errorThread.start();
@@ -89,6 +122,9 @@
}
}
+ /**
+ * Stop pumping the streams.
+ */
public void stop() {
try {
outputThread.join();
@@ -121,22 +157,39 @@
}
}
+ /**
+ * Get the error stream.
+ * @return <CODE>OutputStream</CODE>.
+ */
protected OutputStream getErr() {
return err;
}
+ /**
+ * Get the output stream.
+ * @return <CODE>OutputStream</CODE>.
+ */
protected OutputStream getOut() {
return out;
}
+ /**
+ * Create the pump to handle process output.
+ * @param is the <CODE>InputStream</CODE>.
+ * @param os the <CODE>OutputStream</CODE>.
+ */
protected void createProcessOutputPump(InputStream is, OutputStream os) {
outputThread = createPump(is, os);
}
+ /**
+ * Create the pump to handle error output.
+ * @param is the <CODE>InputStream</CODE>.
+ * @param os the <CODE>OutputStream</CODE>.
+ */
protected void createProcessErrorPump(InputStream is, OutputStream os) {
errorThread = createPump(is, os);
}
-
/**
* Creates a stream pumper to copy the given input stream to the
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]