rabbit.client
Class FileSaver

java.lang.Object
  extended by rabbit.client.FileSaver
All Implemented Interfaces:
AsyncListener, BlockListener

public class FileSaver
extends Object
implements BlockListener

A class to save a ResourceSource into a file. This is mostly an example of how to use the rabbit client classes.

Author:
Robert Olofsson

Constructor Summary
FileSaver(HttpHeader request, ClientBase clientBase, ClientListener listener, ResourceSource rs, File f)
           
 
Method Summary
 void bufferRead(BufferHandle bufHandle)
          A buffer has been read, the buffer has been flip:ed before this call is made so position and remaining are valid.
 void failed(Exception cause)
          Reading failed
 void finishedRead()
          The resource have been fully transferred
 void timeout()
          The operation timed out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSaver

public FileSaver(HttpHeader request,
                 ClientBase clientBase,
                 ClientListener listener,
                 ResourceSource rs,
                 File f)
          throws IOException
Throws:
IOException
Method Detail

bufferRead

public void bufferRead(BufferHandle bufHandle)
Description copied from interface: BlockListener
A buffer has been read, the buffer has been flip:ed before this call is made so position and remaining are valid.

Specified by:
bufferRead in interface BlockListener

finishedRead

public void finishedRead()
Description copied from interface: BlockListener
The resource have been fully transferred

Specified by:
finishedRead in interface BlockListener

failed

public void failed(Exception cause)
Description copied from interface: AsyncListener
Reading failed

Specified by:
failed in interface AsyncListener
Parameters:
cause - the real reason the operation failed.

timeout

public void timeout()
Description copied from interface: AsyncListener
The operation timed out

Specified by:
timeout in interface AsyncListener