Interface CacheFile
- All Known Implementing Classes:
CacheFileWithCache
,CacheFileWithoutCache
,CacheFileWithoutCacheMT
public interface CacheFile
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final short
static final short
static final short
static final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
flushes the cache and discards entriesvoid
close()
long
compareLength
(long compare_to) void
delete()
boolean
exists()
void
flushes the cache to disk but retains entriesvoid
flushCache
(long offset, int length) int
long
long
long
long
int
boolean
isOpen()
void
moveFile
(File new_file, FileUtil.ProgressListener pl) void
read
(DirectByteBuffer[] buffers, long offset, short policy) void
read
(DirectByteBuffer buffer, long offset, short policy) void
renameFile
(String new_name) void
setAccessMode
(int mode) void
setLength
(long length) void
setPieceComplete
(int piece_number, DirectByteBuffer piece_data) void
setStorageType
(int type, boolean force) 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)
-
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
-