From 4e153280009ec87a6c477836a8b04ca7807e6a45 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Wed, 25 Feb 2004 18:58:40 +0000 Subject: [PATCH] Javadoc all public methods. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276163 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/PumpStreamHandler.java | 61 +++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java index d902a11c9..782ecf682 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java +++ b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java @@ -25,8 +25,6 @@ import java.io.OutputStream; * 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. - * * @author thomas.haas@softwired-inc.com * @since Ant 1.2 */ @@ -40,6 +38,12 @@ public class PumpStreamHandler implements ExecuteStreamHandler { private OutputStream err; private InputStream input; + /** + * Construct a new PumpStreamHandler. + * @param out the output OutputStream. + * @param err the error OutputStream. + * @param in the input InputStream. + */ public PumpStreamHandler(OutputStream out, OutputStream err, InputStream input) { this.out = out; @@ -47,29 +51,55 @@ public class PumpStreamHandler implements ExecuteStreamHandler { this.input = input; } + /** + * Construct a new PumpStreamHandler. + * @param out the output OutputStream. + * @param err the error OutputStream. + */ public PumpStreamHandler(OutputStream out, OutputStream err) { this(out, err, null); } + /** + * Construct a new PumpStreamHandler. + * @param outAndErr the output/error OutputStream. + */ public PumpStreamHandler(OutputStream outAndErr) { this(outAndErr, outAndErr); } + /** + * Construct a new PumpStreamHandler. + */ public PumpStreamHandler() { this(System.out, System.err); } + /** + * Set the InputStream from which to read the + * standard output of the process. + * @param is the InputStream. + */ public void setProcessOutputStream(InputStream is) { createProcessOutputPump(is, out); } - + /** + * Set the InputStream from which to read the + * standard error of the process. + * @param is the InputStream. + */ public void setProcessErrorStream(InputStream is) { if (err != null) { createProcessErrorPump(is, err); } } + /** + * Set the OutputStream by means of which + * input can be sent to the process. + * @param os the OutputStream. + */ public void setProcessInputStream(OutputStream os) { if (input != null) { inputThread = createPump(input, os, true); @@ -82,6 +112,9 @@ public class PumpStreamHandler implements ExecuteStreamHandler { } } + /** + * Start the Threads. + */ public void start() { outputThread.start(); errorThread.start(); @@ -90,6 +123,9 @@ public class PumpStreamHandler implements ExecuteStreamHandler { } } + /** + * Stop pumping the streams. + */ public void stop() { try { outputThread.join(); @@ -122,23 +158,40 @@ public class PumpStreamHandler implements ExecuteStreamHandler { } } + /** + * Get the error stream. + * @return OutputStream. + */ protected OutputStream getErr() { return err; } + /** + * Get the output stream. + * @return OutputStream. + */ protected OutputStream getOut() { return out; } + /** + * Create the pump to handle process output. + * @param is the InputStream. + * @param os the OutputStream. + */ protected void createProcessOutputPump(InputStream is, OutputStream os) { outputThread = createPump(is, os); } + /** + * Create the pump to handle error output. + * @param is the InputStream. + * @param os the OutputStream. + */ protected void createProcessErrorPump(InputStream is, OutputStream os) { errorThread = createPump(is, os); } - /** * Creates a stream pumper to copy the given input stream to the * given output stream.