rabbit.httpio
Interface ResourceSource

All Superinterfaces:
Transferable
All Known Implementing Classes:
CacheResourceSource, FileResourceSource, RandomCacheResourceSource, WebConnectionResourceSource

public interface ResourceSource
extends Transferable

A resource source. Use supportsTransfer to check if this resource supports transfer, if it does then use the transferTo method. A resource that does not support transfer will listen for blocks that are read, using a BlockListener.

Author:
Robert Olofsson

Method Summary
 void addBlockListener(BlockListener bl)
          Add a ByteBuffer listener.
 void release()
          Release any held resources.
 boolean supportsTransfer()
          Return true if FileChannel.transferTo can be used.
 
Methods inherited from interface rabbit.httpio.Transferable
length, transferTo
 

Method Detail

supportsTransfer

boolean supportsTransfer()
Return true if FileChannel.transferTo can be used. Will generally only be true if the resource is served from a FileChannel.

Returns:
true if transferTo can be used, false otherwise

addBlockListener

void addBlockListener(BlockListener bl)
Add a ByteBuffer listener.

Parameters:
bl - the listener that will get notified when data is available

release

void release()
Release any held resources.