com.sun.labs.minion.test.util
Class Pipe

java.lang.Object
  extended by com.sun.labs.minion.test.util.Pipe

public class Pipe
extends java.lang.Object

This class links input and output streams so that data taken from input stream is transfered to the output stream. This class can be used to connect standard input/ouput stream of Java application with output/input streams of spawned child process, so that all user's input is redirected to the child and all it's output is visible for the user.

This class starts a thread, which transfers data from input stream to output stream until End Of File is reached or IOException caused by IO error is catched.


Field Summary
static int defaultBufferSize
          Default size of buffer used to transfer data from the input stream to the output stream.
 
Constructor Summary
Pipe()
           
 
Method Summary
static void between(java.io.InputStream in, java.io.OutputStream out)
          Establish connection between input and output streams with default buffer size.
static void between(java.io.InputStream in, java.io.OutputStream out, int bufferSize)
          Establish connection between input and output streams with specified size of buffer used for data transfer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultBufferSize

public static int defaultBufferSize
Default size of buffer used to transfer data from the input stream to the output stream.

Constructor Detail

Pipe

public Pipe()
Method Detail

between

public static void between(java.io.InputStream in,
                           java.io.OutputStream out,
                           int bufferSize)
Establish connection between input and output streams with specified size of buffer used for data transfer.

Parameters:
in - input stream
out - output stream
bufferSize - size of buffer used to transfer data from the input stream to the output stream

between

public static void between(java.io.InputStream in,
                           java.io.OutputStream out)
Establish connection between input and output streams with default buffer size.

Parameters:
in - input stream
out - output stream