Methods Summary |
---|
public void | clearCache()
|
public void | close()
try{
file.close();
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public long | compareLength(long compare_to)
return( getLength() - compare_to );
|
public void | delete()
try{
file.delete();
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | ensureOpen(java.lang.String reason)
try{
file.ensureOpen( reason );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public boolean | exists()
return( file.exists());
|
public void | flushCache()
try{
file.flush();
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public int | getAccessMode()
return( file.getAccessMode()==FMFile.FM_READ?CF_READ:CF_WRITE );
|
public long | getLength()
try{
return( file.getLength());
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
return( 0 );
}
|
public int | getStorageType()
return( file.getStorageType()==FMFile.FT_COMPACT?CT_COMPACT:CT_LINEAR );
|
public org.gudy.azureus2.core3.torrent.TOTorrentFile | getTorrentFile()
return( torrent_file );
|
public boolean | isOpen()
return( file.isOpen());
|
public void | moveFile(java.io.File new_file)
try{
file.moveFile( new_file );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | read(org.gudy.azureus2.core3.util.DirectByteBuffer[] buffers, long position, short policy)
int read_length = 0;
for (int i=0;i<buffers.length;i++){
read_length += buffers[i].remaining(DirectByteBuffer.SS_CACHE);
}
try{
file.read( buffers, position );
manager.fileBytesRead( read_length );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | read(org.gudy.azureus2.core3.util.DirectByteBuffer buffer, long position, short policy)
int read_length = buffer.remaining(DirectByteBuffer.SS_CACHE);
try{
file.read( buffer, position );
manager.fileBytesRead( read_length );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | setAccessMode(int mode)
try{
file.setAccessMode( mode==CF_READ?FMFile.FM_READ:FMFile.FM_WRITE );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | setLength(long length)
try{
file.setLength( length );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | setStorageType(int type)
try{
file.setStorageType( type==CT_COMPACT?FMFile.FT_COMPACT:FMFile.FT_LINEAR );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | write(org.gudy.azureus2.core3.util.DirectByteBuffer buffer, long position)
int write_length = buffer.remaining(DirectByteBuffer.SS_CACHE);
try{
file.write( buffer, position );
manager.fileBytesWritten( write_length );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | write(org.gudy.azureus2.core3.util.DirectByteBuffer[] buffers, long position)
int write_length = 0;
for (int i=0;i<buffers.length;i++){
write_length += buffers[i].remaining(DirectByteBuffer.SS_CACHE);
}
try{
file.write( buffers, position );
manager.fileBytesWritten( write_length );
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}
|
public void | writeAndHandoverBuffer(org.gudy.azureus2.core3.util.DirectByteBuffer buffer, long position)
int write_length = buffer.remaining(DirectByteBuffer.SS_CACHE);
boolean write_ok = false;
try{
file.write( buffer, position );
manager.fileBytesWritten( write_length );
write_ok = true;
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}finally{
if ( write_ok ){
buffer.returnToPool();
}
}
|
public void | writeAndHandoverBuffers(org.gudy.azureus2.core3.util.DirectByteBuffer[] buffers, long position)
int write_length = 0;
for (int i=0;i<buffers.length;i++){
write_length += buffers[i].remaining(DirectByteBuffer.SS_CACHE);
}
boolean write_ok = false;
try{
file.write( buffers, position );
manager.fileBytesWritten( write_length );
write_ok = true;
}catch( FMFileManagerException e ){
manager.rethrow(this,e);
}finally{
if ( write_ok ){
for (int i=0;i<buffers.length;i++){
buffers[i].returnToPool();
}
}
}
|