Interface CacheFile
- All Known Implementing Classes:
CacheFileWithCache, CacheFileWithoutCache, CacheFileWithoutCacheMT
public interface CacheFile
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final shortstatic final shortstatic final shortstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidflushes the cache and discards entriesvoidclose()longcompareLength(long compare_to) voiddelete()booleanexists()voidflushes the cache to disk but retains entriesvoidflushCache(long offset, int length) intlonglonglonglongintbooleanisOpen()voidmoveFile(File new_file, FileUtil.ProgressListener pl) voidread(DirectByteBuffer[] buffers, long offset, short policy) voidread(DirectByteBuffer buffer, long offset, short policy) voidrenameFile(String new_name) voidsetAccessMode(int mode) voidsetLength(long length) voidsetPieceComplete(int piece_number, DirectByteBuffer piece_data) voidsetStorageType(int type, boolean force) voidwrite(DirectByteBuffer[] buffers, long position) voidwrite(DirectByteBuffer buffer, long position) voidwriteAndHandoverBuffer(DirectByteBuffer buffer, long position) writes the block to the cache and gives control of the buffer to the cache.voidwriteAndHandoverBuffers(DirectByteBuffer[] buffers, long position)
-
Field Details
-
CT_LINEAR
static final int CT_LINEAR- See Also:
-
CT_COMPACT
static final int CT_COMPACT- See Also:
-
CT_PIECE_REORDER
static final int CT_PIECE_REORDER- See Also:
-
CT_PIECE_REORDER_COMPACT
static final int CT_PIECE_REORDER_COMPACT- See Also:
-
CF_READ
static final int CF_READ- See Also:
-
CF_WRITE
static final int CF_WRITE- See Also:
-
CP_NONE
static final short CP_NONE- See Also:
-
CP_READ_CACHE
static final short CP_READ_CACHE- See Also:
-
CP_FLUSH
static final short CP_FLUSH- See Also:
-
-
Method Details
-
getTorrentFile
TOTorrentFile getTorrentFile() -
exists
boolean exists() -
moveFile
- Throws:
CacheFileManagerException
-
renameFile
- Throws:
CacheFileManagerException
-
setAccessMode
- Throws:
CacheFileManagerException
-
getAccessMode
int getAccessMode() -
setStorageType
- Throws:
CacheFileManagerException
-
getStorageType
int getStorageType() -
getLength
- Throws:
CacheFileManagerException
-
compareLength
- Throws:
CacheFileManagerException
-
setLength
- Throws:
CacheFileManagerException
-
setPieceComplete
void setPieceComplete(int piece_number, DirectByteBuffer piece_data) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
read
- Throws:
CacheFileManagerException
-
read
- Throws:
CacheFileManagerException
-
write
- Throws:
CacheFileManagerException
-
write
- Throws:
CacheFileManagerException
-
writeAndHandoverBuffer
void writeAndHandoverBuffer(DirectByteBuffer buffer, long position) throws CacheFileManagerException writes the block to the cache and gives control of the buffer to the cache.- Parameters:
buffer-position-- Throws:
CacheFileManagerException- write failed and buffer *not* taken - i.e. caller must de-allocate
-
writeAndHandoverBuffers
void writeAndHandoverBuffers(DirectByteBuffer[] buffers, long position) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
flushCache
flushes the cache to disk but retains entries- Throws:
CacheFileManagerException
-
flushCache
- Throws:
CacheFileManagerException
-
clearCache
flushes the cache and discards entries- Throws:
CacheFileManagerException
-
close
- Throws:
CacheFileManagerException
-
isOpen
boolean isOpen() -
getSessionBytesRead
long getSessionBytesRead() -
getSessionBytesWritten
long getSessionBytesWritten() -
getLastModified
long getLastModified() -
delete
- Throws:
CacheFileManagerException
-