org.apache.karaf.util.process
Class PumpStreamHandler

java.lang.Object
  extended by org.apache.karaf.util.process.PumpStreamHandler

public class PumpStreamHandler
extends java.lang.Object

Copies standard output and error of children streams to standard output and error of the parent.

Version:
$Rev: 705608 $ $Date: 2008-10-17 15:28:45 +0200 (Fri, 17 Oct 2008) $

Constructor Summary
PumpStreamHandler(java.io.InputStream in, java.io.OutputStream out, java.io.OutputStream err)
           
PumpStreamHandler(java.io.InputStream in, java.io.OutputStream out, java.io.OutputStream err, java.lang.String name)
           
PumpStreamHandler(java.io.OutputStream outAndErr)
           
PumpStreamHandler(java.io.OutputStream out, java.io.OutputStream err)
           
 
Method Summary
 void attach(java.lang.Process p)
          Attach to a child streams from the given process.
protected  void createChildErrorPump(java.io.InputStream in, java.io.OutputStream out)
          Create the pump to handle error output.
protected  void createChildOutputPump(java.io.InputStream in, java.io.OutputStream out)
          Create the pump to handle child output.
protected  StreamPumper createInputPump(java.io.InputStream in, java.io.OutputStream out, boolean closeWhenExhausted)
          Creates a stream pumper to copy the given input stream to the given output stream.
protected  StreamPumper createPump(java.io.InputStream in, java.io.OutputStream out)
          Creates a stream pumper to copy the given input stream to the given output stream.
protected  StreamPumper createPump(java.io.InputStream in, java.io.OutputStream out, boolean closeWhenExhausted)
          Creates a stream pumper to copy the given input stream to the given output stream.
 void setChildErrorStream(java.io.InputStream in)
          Set the input stream from which to read the standard error of the child.
 void setChildInputStream(java.io.OutputStream out)
          Set the output stream by means of which input can be sent to the child.
 void setChildOutputStream(java.io.InputStream in)
          Set the input stream from which to read the standard output of the child.
 void start()
          Start pumping the streams.
 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(java.io.InputStream in,
                         java.io.OutputStream out,
                         java.io.OutputStream err,
                         java.lang.String name)

PumpStreamHandler

public PumpStreamHandler(java.io.InputStream in,
                         java.io.OutputStream out,
                         java.io.OutputStream err)

PumpStreamHandler

public PumpStreamHandler(java.io.OutputStream out,
                         java.io.OutputStream err)

PumpStreamHandler

public PumpStreamHandler(java.io.OutputStream outAndErr)
Method Detail

setChildOutputStream

public void setChildOutputStream(java.io.InputStream in)
Set the input stream from which to read the standard output of the child.


setChildErrorStream

public void setChildErrorStream(java.io.InputStream in)
Set the input stream from which to read the standard error of the child.


setChildInputStream

public void setChildInputStream(java.io.OutputStream out)
Set the output stream by means of which input can be sent to the child.


attach

public void attach(java.lang.Process p)
Attach to a child streams from the given process.

Parameters:
p - The process to attach to.

start

public void start()
Start pumping the streams.


stop

public void stop()
Stop pumping the streams.


createChildOutputPump

protected void createChildOutputPump(java.io.InputStream in,
                                     java.io.OutputStream out)
Create the pump to handle child output.


createChildErrorPump

protected void createChildErrorPump(java.io.InputStream in,
                                    java.io.OutputStream out)
Create the pump to handle error output.


createPump

protected StreamPumper createPump(java.io.InputStream in,
                                  java.io.OutputStream out)
Creates a stream pumper to copy the given input stream to the given output stream.


createPump

protected StreamPumper createPump(java.io.InputStream in,
                                  java.io.OutputStream out,
                                  boolean closeWhenExhausted)
Creates a stream pumper to copy the given input stream to the given output stream.

Parameters:
in - The input stream to copy from.
out - The output stream to copy to.
closeWhenExhausted - If true close the inputstream.
Returns:
A thread object that does the pumping.

createInputPump

protected StreamPumper createInputPump(java.io.InputStream in,
                                       java.io.OutputStream out,
                                       boolean closeWhenExhausted)
Creates a stream pumper to copy the given input stream to the given output stream. Used for standard input.



Copyright © 2007-2011 Apache Software Foundation. All Rights Reserved.