issrg.test.repository
Class TrafficForwarder

java.lang.Object
  extended by issrg.test.repository.TrafficForwarder
All Implemented Interfaces:
java.lang.Runnable

public class TrafficForwarder
extends java.lang.Object
implements java.lang.Runnable

A TrafficForwarder forwards the traffic from an input stream to an output stream.

Author:
Linying Su

Constructor Summary
TrafficForwarder(java.io.InputStream istream, java.io.OutputStream ostream, int size)
          Constructs an instance of a TrafficForwarder.
 
Method Summary
 void run()
          Starts the actual transfer from the input to the output stream.
 void stop()
          Stops the transfer from the input to the output stream by closing the input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrafficForwarder

public TrafficForwarder(java.io.InputStream istream,
                        java.io.OutputStream ostream,
                        int size)
Constructs an instance of a TrafficForwarder. The constructor doesn't start the actual forwarding, for that one has to use the run method.

Parameters:
istream - the input stream which will be read
ostream - the output stream to write to
size - the size of the buffer to use during the transfer
Method Detail

run

public void run()
Starts the actual transfer from the input to the output stream.

Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Stops the transfer from the input to the output stream by closing the input stream.