rabbit.httpio
Class TransferHandler

java.lang.Object
  extended by rabbit.httpio.TransferHandler
All Implemented Interfaces:
Runnable

public class TransferHandler
extends Object
implements Runnable

A handler that transfers data from a Transferable to a socket channel. Since file transfers may take time we run in a separate thread.

Author:
Robert Olofsson

Constructor Summary
TransferHandler(NioHandler nioHandler, Transferable t, SocketChannel channel, TrafficLogger tlFrom, TrafficLogger tlTo, TransferListener listener)
          Create a new TransferHandler
 
Method Summary
 void run()
           
 void transfer()
          Start the data transfer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransferHandler

public TransferHandler(NioHandler nioHandler,
                       Transferable t,
                       SocketChannel channel,
                       TrafficLogger tlFrom,
                       TrafficLogger tlTo,
                       TransferListener listener)
Create a new TransferHandler

Parameters:
nioHandler - the NioHandler to use for network and background tasks
t - the resource to transfer
channel - the Channel to transfer the resource to
tlFrom - the network statistics for the source
tlTo - the network statistics for the sink
listener - the listener that will be notified when the transfer has completed
Method Detail

transfer

public void transfer()
Start the data transfer.


run

public void run()
Specified by:
run in interface Runnable