Class CacheFileWithoutCache
- java.lang.Object
-
- com.biglybt.core.diskmanager.cache.impl.CacheFileWithoutCache
-
-
Field Summary
Fields Modifier and Type Field Description private long
bytes_read
private long
bytes_written
protected FMFile
file
protected CacheFileManagerImpl
manager
protected TOTorrentFile
torrent_file
-
Fields inherited from interface com.biglybt.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
Constructors Modifier Constructor Description protected
CacheFileWithoutCache(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
flushes the cache and discards entriesvoid
close()
long
compareLength(long compare_to)
void
delete()
boolean
exists()
void
flushCache()
flushes the cache to disk but retains entriesvoid
flushCache(long offset, int length)
int
getAccessMode()
long
getLastModified()
long
getLength()
long
getSessionBytesRead()
long
getSessionBytesWritten()
int
getStorageType()
TOTorrentFile
getTorrentFile()
boolean
isOpen()
void
moveFile(java.io.File new_file, FileUtil.ProgressListener pl)
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, 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 Detail
-
manager
protected final CacheFileManagerImpl manager
-
file
protected final FMFile file
-
torrent_file
protected final TOTorrentFile torrent_file
-
bytes_written
private long bytes_written
-
bytes_read
private long bytes_read
-
-
Constructor Detail
-
CacheFileWithoutCache
protected CacheFileWithoutCache(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file)
-
-
Method Detail
-
getTorrentFile
public TOTorrentFile getTorrentFile()
- Specified by:
getTorrentFile
in interfaceCacheFile
-
moveFile
public void moveFile(java.io.File new_file, FileUtil.ProgressListener pl) throws CacheFileManagerException
- Specified by:
moveFile
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
renameFile
public void renameFile(java.lang.String new_file) throws CacheFileManagerException
- Specified by:
renameFile
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
setAccessMode
public void setAccessMode(int mode) throws CacheFileManagerException
- Specified by:
setAccessMode
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getAccessMode
public int getAccessMode()
- Specified by:
getAccessMode
in interfaceCacheFile
-
setStorageType
public void setStorageType(int type, boolean force) throws CacheFileManagerException
- Specified by:
setStorageType
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getStorageType
public int getStorageType()
- Specified by:
getStorageType
in interfaceCacheFile
-
getLength
public long getLength() throws CacheFileManagerException
- Specified by:
getLength
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
compareLength
public long compareLength(long compare_to) throws CacheFileManagerException
- Specified by:
compareLength
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
setLength
public void setLength(long length) throws CacheFileManagerException
- Specified by:
setLength
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
setPieceComplete
public void setPieceComplete(int piece_number, DirectByteBuffer piece_data) throws CacheFileManagerException
- Specified by:
setPieceComplete
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
read
public void read(DirectByteBuffer[] buffers, long position, short policy) throws CacheFileManagerException
- Specified by:
read
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
read
public void read(DirectByteBuffer buffer, long position, short policy) throws CacheFileManagerException
- Specified by:
read
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
write
public void write(DirectByteBuffer buffer, long position) throws CacheFileManagerException
- Specified by:
write
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
write
public void write(DirectByteBuffer[] buffers, long position) throws CacheFileManagerException
- Specified by:
write
in interfaceCacheFile
- 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 interfaceCacheFile
- 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 interfaceCacheFile
- 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 interfaceCacheFile
- Throws:
CacheFileManagerException
-
flushCache
public void flushCache(long offset, int length) throws CacheFileManagerException
- Specified by:
flushCache
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
clearCache
public void clearCache() throws CacheFileManagerException
Description copied from interface:CacheFile
flushes the cache and discards entries- Specified by:
clearCache
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
close
public void close() throws CacheFileManagerException
- Specified by:
close
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getSessionBytesRead
public long getSessionBytesRead()
- Specified by:
getSessionBytesRead
in interfaceCacheFile
-
getSessionBytesWritten
public long getSessionBytesWritten()
- Specified by:
getSessionBytesWritten
in interfaceCacheFile
-
getLastModified
public long getLastModified()
- Specified by:
getLastModified
in interfaceCacheFile
-
delete
public void delete() throws CacheFileManagerException
- Specified by:
delete
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
-