|
|
@@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
* Copyright 2000-2005 The Apache Software Foundation |
|
|
|
* Copyright 2000-2006 The Apache Software Foundation |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
@@ -38,10 +38,10 @@ public class PumpStreamHandler implements ExecuteStreamHandler { |
|
|
|
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>. |
|
|
|
* 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) { |
|
|
@@ -51,42 +51,42 @@ public class PumpStreamHandler implements ExecuteStreamHandler { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Construct a new <CODE>PumpStreamHandler</CODE>. |
|
|
|
* @param out the output <CODE>OutputStream</CODE>. |
|
|
|
* @param err the error <CODE>OutputStream</CODE>. |
|
|
|
* 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>. |
|
|
|
* 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>. |
|
|
|
* Construct a new <code>PumpStreamHandler</code>. |
|
|
|
*/ |
|
|
|
public PumpStreamHandler() { |
|
|
|
this(System.out, System.err); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Set the <CODE>InputStream</CODE> from which to read the |
|
|
|
* Set the <code>InputStream</code> from which to read the |
|
|
|
* standard output of the process. |
|
|
|
* @param is the <CODE>InputStream</CODE>. |
|
|
|
* @param is the <code>InputStream</code>. |
|
|
|
*/ |
|
|
|
public void setProcessOutputStream(InputStream is) { |
|
|
|
createProcessOutputPump(is, out); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Set the <CODE>InputStream</CODE> from which to read the |
|
|
|
* Set the <code>InputStream</code> from which to read the |
|
|
|
* standard error of the process. |
|
|
|
* @param is the <CODE>InputStream</CODE>. |
|
|
|
* @param is the <code>InputStream</code>. |
|
|
|
*/ |
|
|
|
public void setProcessErrorStream(InputStream is) { |
|
|
|
if (err != null) { |
|
|
@@ -95,9 +95,9 @@ public class PumpStreamHandler implements ExecuteStreamHandler { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Set the <CODE>OutputStream</CODE> by means of which |
|
|
|
* Set the <code>OutputStream</code> by means of which |
|
|
|
* input can be sent to the process. |
|
|
|
* @param os the <CODE>OutputStream</CODE>. |
|
|
|
* @param os the <code>OutputStream</code>. |
|
|
|
*/ |
|
|
|
public void setProcessInputStream(OutputStream os) { |
|
|
|
if (input != null) { |
|
|
@@ -112,7 +112,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Start the <CODE>Thread</CODE>s. |
|
|
|
* Start the <code>Thread</code>s. |
|
|
|
*/ |
|
|
|
public void start() { |
|
|
|
outputThread.start(); |
|
|
@@ -157,7 +157,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler { |
|
|
|
|
|
|
|
/** |
|
|
|
* Get the error stream. |
|
|
|
* @return <CODE>OutputStream</CODE>. |
|
|
|
* @return <code>OutputStream</code>. |
|
|
|
*/ |
|
|
|
protected OutputStream getErr() { |
|
|
|
return err; |
|
|
@@ -165,7 +165,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler { |
|
|
|
|
|
|
|
/** |
|
|
|
* Get the output stream. |
|
|
|
* @return <CODE>OutputStream</CODE>. |
|
|
|
* @return <code>OutputStream</code>. |
|
|
|
*/ |
|
|
|
protected OutputStream getOut() { |
|
|
|
return out; |
|
|
|