rabbit.proxy
Class RandomCacheResourceSource

java.lang.Object
  extended by rabbit.httpio.FileResourceSource
      extended by rabbit.proxy.CacheResourceSource
          extended by rabbit.proxy.RandomCacheResourceSource
All Implemented Interfaces:
ResourceSource, Transferable

public class RandomCacheResourceSource
extends CacheResourceSource

A resource that gets ranges from the cache. This resource will read data from disk so it may block.

Author:
Robert Olofsson

Field Summary
 
Fields inherited from class rabbit.httpio.FileResourceSource
bufHandle, fc
 
Constructor Summary
RandomCacheResourceSource(Cache<HttpHeader,HttpHeader> cache, rabbit.proxy.RequestHandler rh, TaskRunner tr, BufferHandler bufHandler, List<Range> ranges, long totalSize)
           
 
Method Summary
 void addBlockListener(BlockListener listener)
          Generally we do not come into this method, but it can happen..
 boolean supportsTransfer()
          FileChannels can only be partially used so go with blocks.
 
Methods inherited from class rabbit.httpio.FileResourceSource
length, release, transferTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomCacheResourceSource

public RandomCacheResourceSource(Cache<HttpHeader,HttpHeader> cache,
                                 rabbit.proxy.RequestHandler rh,
                                 TaskRunner tr,
                                 BufferHandler bufHandler,
                                 List<Range> ranges,
                                 long totalSize)
                          throws IOException
Throws:
IOException
Method Detail

supportsTransfer

public boolean supportsTransfer()
FileChannels can only be partially used so go with blocks.

Specified by:
supportsTransfer in interface ResourceSource
Overrides:
supportsTransfer in class FileResourceSource
Returns:
false

addBlockListener

public void addBlockListener(BlockListener listener)
Description copied from class: FileResourceSource
Generally we do not come into this method, but it can happen..

Specified by:
addBlockListener in interface ResourceSource
Overrides:
addBlockListener in class FileResourceSource