com.aelitis.azureus.core.diskmanager.cache.impl
Class CacheFileWithoutCache

java.lang.Object
  extended by com.aelitis.azureus.core.diskmanager.cache.impl.CacheFileWithoutCache
All Implemented Interfaces:
CacheFile

public class CacheFileWithoutCache
extends java.lang.Object
implements CacheFile


Field Summary
protected  FMFile file
           
protected  CacheFileManagerImpl manager
           
protected  TOTorrentFile torrent_file
           
 
Fields inherited from interface com.aelitis.azureus.core.diskmanager.cache.CacheFile
CF_READ, CF_WRITE, CP_FLUSH, CP_NONE, CP_READ_CACHE, CT_COMPACT, CT_LINEAR, CT_PIECE_REORDER, CT_PIECE_REORDER_COMPACT
 
Constructor Summary
protected CacheFileWithoutCache(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file)
           
 
Method Summary
 void clearCache()
          flushes the cache and discards entries
 void close()
           
 long compareLength(long compare_to)
           
 void delete()
           
 boolean exists()
           
 void flushCache()
          flushes the cache to disk but retains entries
 int getAccessMode()
           
 long getLength()
           
 long getSessionBytesRead()
           
 long getSessionBytesWritten()
           
 int getStorageType()
           
 TOTorrentFile getTorrentFile()
           
 boolean isOpen()
           
 void moveFile(java.io.File new_file)
           
 void read(DirectByteBuffer[] buffers, long position, short policy)
           
 void read(DirectByteBuffer buffer, long position, short policy)
           
 void renameFile(java.lang.String new_file)
           
 void setAccessMode(int mode)
           
 void setLength(long length)
           
 void setPieceComplete(int piece_number, DirectByteBuffer piece_data)
           
 void setStorageType(int type)
           
 void write(DirectByteBuffer[] buffers, long position)
           
 void write(DirectByteBuffer buffer, long position)
           
 void writeAndHandoverBuffer(DirectByteBuffer buffer, long position)
          writes the block to the cache and gives control of the buffer to the cache.
 void writeAndHandoverBuffers(DirectByteBuffer[] buffers, long position)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

protected final CacheFileManagerImpl manager

file

protected final FMFile file

torrent_file

protected final TOTorrentFile torrent_file
Constructor Detail

CacheFileWithoutCache

protected CacheFileWithoutCache(CacheFileManagerImpl _manager,
                                FMFile _file,
                                TOTorrentFile _torrent_file)
Method Detail

getTorrentFile

public TOTorrentFile getTorrentFile()
Specified by:
getTorrentFile in interface CacheFile

exists

public boolean exists()
Specified by:
exists in interface CacheFile

moveFile

public void moveFile(java.io.File new_file)
              throws CacheFileManagerException
Specified by:
moveFile in interface CacheFile
Throws:
CacheFileManagerException

renameFile

public void renameFile(java.lang.String new_file)
                throws CacheFileManagerException
Specified by:
renameFile in interface CacheFile
Throws:
CacheFileManagerException

setAccessMode

public void setAccessMode(int mode)
                   throws CacheFileManagerException
Specified by:
setAccessMode in interface CacheFile
Throws:
CacheFileManagerException

getAccessMode

public int getAccessMode()
Specified by:
getAccessMode in interface CacheFile

setStorageType

public void setStorageType(int type)
                    throws CacheFileManagerException
Specified by:
setStorageType in interface CacheFile
Throws:
CacheFileManagerException

getStorageType

public int getStorageType()
Specified by:
getStorageType in interface CacheFile

getLength

public long getLength()
               throws CacheFileManagerException
Specified by:
getLength in interface CacheFile
Throws:
CacheFileManagerException

compareLength

public long compareLength(long compare_to)
                   throws CacheFileManagerException
Specified by:
compareLength in interface CacheFile
Throws:
CacheFileManagerException

setLength

public void setLength(long length)
               throws CacheFileManagerException
Specified by:
setLength in interface CacheFile
Throws:
CacheFileManagerException

setPieceComplete

public void setPieceComplete(int piece_number,
                             DirectByteBuffer piece_data)
                      throws CacheFileManagerException
Specified by:
setPieceComplete in interface CacheFile
Throws:
CacheFileManagerException

read

public void read(DirectByteBuffer[] buffers,
                 long position,
                 short policy)
          throws CacheFileManagerException
Specified by:
read in interface CacheFile
Throws:
CacheFileManagerException

read

public void read(DirectByteBuffer buffer,
                 long position,
                 short policy)
          throws CacheFileManagerException
Specified by:
read in interface CacheFile
Throws:
CacheFileManagerException

write

public void write(DirectByteBuffer buffer,
                  long position)
           throws CacheFileManagerException
Specified by:
write in interface CacheFile
Throws:
CacheFileManagerException

write

public void write(DirectByteBuffer[] buffers,
                  long position)
           throws CacheFileManagerException
Specified by:
write in interface CacheFile
Throws:
CacheFileManagerException

writeAndHandoverBuffer

public void writeAndHandoverBuffer(DirectByteBuffer buffer,
                                   long position)
                            throws CacheFileManagerException
Description copied from interface: CacheFile
writes the block to the cache and gives control of the buffer to the cache.

Specified by:
writeAndHandoverBuffer in interface CacheFile
Throws:
CacheFileManagerException - write failed and buffer *not* taken - i.e. caller must de-allocate

writeAndHandoverBuffers

public void writeAndHandoverBuffers(DirectByteBuffer[] buffers,
                                    long position)
                             throws CacheFileManagerException
Specified by:
writeAndHandoverBuffers in interface CacheFile
Throws:
CacheFileManagerException

flushCache

public void flushCache()
                throws CacheFileManagerException
Description copied from interface: CacheFile
flushes the cache to disk but retains entries

Specified by:
flushCache in interface CacheFile
Throws:
CacheFileManagerException

clearCache

public void clearCache()
                throws CacheFileManagerException
Description copied from interface: CacheFile
flushes the cache and discards entries

Specified by:
clearCache in interface CacheFile
Throws:
CacheFileManagerException

close

public void close()
           throws CacheFileManagerException
Specified by:
close in interface CacheFile
Throws:
CacheFileManagerException

isOpen

public boolean isOpen()
Specified by:
isOpen in interface CacheFile

getSessionBytesRead

public long getSessionBytesRead()
Specified by:
getSessionBytesRead in interface CacheFile

getSessionBytesWritten

public long getSessionBytesWritten()
Specified by:
getSessionBytesWritten in interface CacheFile

delete

public void delete()
            throws CacheFileManagerException
Specified by:
delete in interface CacheFile
Throws:
CacheFileManagerException