Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.exec
Class PumpStreamHandler

    java.lang.Object
      org.apache.commons.exec.PumpStreamHandler

All Implemented Interfaces:
  ExecuteStreamHandler

    public class PumpStreamHandler

extends Object
implements ExecuteStreamHandler

Copies standard output and error of subprocesses to standard output and error of the parent process. If output or error stream are set to null, any feedback from that stream will be lost.

Constructor Summary
`PumpStreamHandler()` Construct a new `PumpStreamHandler`.
`PumpStreamHandler(OutputStream outAndErr)` Construct a new `PumpStreamHandler`.
`PumpStreamHandler(OutputStream out, OutputStream err)` Construct a new `PumpStreamHandler`.
`PumpStreamHandler(OutputStream out, OutputStream err, InputStream input)` Construct a new `PumpStreamHandler`.

Method Summary
`protected void` | `createProcessErrorPump(InputStream is, OutputStream os)` Create the pump to handle error output.
`protected void` | `createProcessOutputPump(InputStream is, OutputStream os)` Create the pump to handle process output.
`protected Thread` | `createPump(InputStream is, OutputStream os)` Creates a stream pumper to copy the given input stream to the given output stream.
`protected Thread` | `createPump(InputStream is, OutputStream os, boolean closeWhenExhausted)` Creates a stream pumper to copy the given input stream to the given output stream.
`protected OutputStream` | `getErr()` Get the error stream.
`protected OutputStream` | `getOut()` Get the output stream.
`void` | `setProcessErrorStream(InputStream is)` Set the `InputStream` from which to read the standard error of the process.
`void` | `setProcessInputStream(OutputStream os)` Set the `OutputStream` by means of which input can be sent to the process.
`void` | `setProcessOutputStream(InputStream is)` Set the `InputStream` from which to read the standard output of the process.
`void` | `start()` Start the `Thread`s.
`void` | `stop()` Stop pumping the streams.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PumpStreamHandler

    public PumpStreamHandler(OutputStream out,
                             OutputStream err,
                             InputStream input)

  Construct a new `PumpStreamHandler`.

  Parameters:
    `out` - the output `OutputStream`.
    `err` - the error `OutputStream`.
    `input` - the input `InputStream`.

### PumpStreamHandler

    public PumpStreamHandler(OutputStream out,
                             OutputStream err)

  Construct a new `PumpStreamHandler`.

  Parameters:
    `out` - the output `OutputStream`.
    `err` - the error `OutputStream`.

### PumpStreamHandler

    public PumpStreamHandler(OutputStream outAndErr)

  Construct a new `PumpStreamHandler`.

  Parameters:
    `outAndErr` - the output/error `OutputStream`.

### PumpStreamHandler

    public PumpStreamHandler()

  Construct a new `PumpStreamHandler`.

Method Detail

### setProcessOutputStream

    public void setProcessOutputStream(InputStream is)

  Set the `InputStream` from which to read the standard output of the process.

  Specified by:
    `setProcessOutputStream` in interface `ExecuteStreamHandler`
  Parameters:
    `is` - the `InputStream`.

### setProcessErrorStream

    public void setProcessErrorStream(InputStream is)

  Set the `InputStream` from which to read the standard error of the process.

  Specified by:
    `setProcessErrorStream` in interface `ExecuteStreamHandler`
  Parameters:
    `is` - the `InputStream`.

### setProcessInputStream

    public void setProcessInputStream(OutputStream os)

  Set the `OutputStream` by means of which input can be sent to the process.

  Specified by:
    `setProcessInputStream` in interface `ExecuteStreamHandler`
  Parameters:
    `os` - the `OutputStream`.

### start

    public void start()

  Start the `Thread`s.

  Specified by:
    `start` in interface `ExecuteStreamHandler`

### stop

    public void stop()

  Stop pumping the streams.

  Specified by:
    `stop` in interface `ExecuteStreamHandler`

### getErr

    protected OutputStream getErr()

  Get the error stream.

  Returns:
    `OutputStream`.

### getOut

    protected OutputStream getOut()

  Get the output stream.

  Returns:
    `OutputStream`.

### createProcessOutputPump

    protected void createProcessOutputPump(InputStream is,
                                           OutputStream os)

  Create the pump to handle process output.

  Parameters:
    `is` - the `InputStream`.
    `os` - the `OutputStream`.

### createProcessErrorPump

    protected void createProcessErrorPump(InputStream is,
                                          OutputStream os)

  Create the pump to handle error output.

  Parameters:
    `is` - the `InputStream`.
    `os` - the `OutputStream`.

### createPump

    protected Thread createPump(InputStream is,
                                OutputStream os)

  Creates a stream pumper to copy the given input stream to the given output stream.

  Parameters:
    `is` - the input stream to copy from
    `os` - the output stream to copy into
  Returns:
    the stream pumper thread

### createPump

    protected Thread createPump(InputStream is,
                                OutputStream os,
                                boolean closeWhenExhausted)

  Creates a stream pumper to copy the given input stream to the given output stream.

  Parameters:
    `is` - the input stream to copy from
    `os` - the output stream to copy into
    `closeWhenExhausted` - close the output stream when the input stream is exhausted
  Returns:
    the stream pumper thread

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.