FMFileTestImplpublic class FMFileTestImpl extends FMFileUnlimited
Fields Summary |
---|
protected long | file_offset_in_torrent |
Constructors Summary |
---|
protected FMFileTestImpl(FMFileOwner _owner, FMFileManagerImpl _manager, File _file, int _type)
super( _owner, _manager, _file, _type );
TOTorrentFile torrent_file = getOwner().getTorrentFile();
TOTorrent torrent = torrent_file.getTorrent();
for (int i=0;i<torrent.getFiles().length;i++){
TOTorrentFile f = torrent.getFiles()[i];
if ( f == torrent_file ){
break;
}
file_offset_in_torrent += f.getLength();
}
|
Methods Summary |
---|
protected void | readSupport(org.gudy.azureus2.core3.util.DirectByteBuffer buffer, long offset)
if ( AEDiagnostics.CHECK_DUMMY_FILE_DATA ){
offset += file_offset_in_torrent;
while( buffer.hasRemaining( DirectByteBuffer.SS_FILE )){
buffer.put( DirectByteBuffer.SS_FILE, (byte)offset++ );
}
}else{
buffer.position( DirectByteBuffer.SS_FILE, buffer.limit( DirectByteBuffer.SS_FILE ));
}
| protected void | writeSupport(org.gudy.azureus2.core3.util.DirectByteBuffer[] buffers, long offset)
offset += file_offset_in_torrent;
for (int i=0;i<buffers.length;i++){
DirectByteBuffer buffer = buffers[i];
if ( AEDiagnostics.CHECK_DUMMY_FILE_DATA ){
while( buffer.hasRemaining( DirectByteBuffer.SS_FILE )){
byte v = buffer.get( DirectByteBuffer.SS_FILE );
if ((byte)offset != v ){
System.out.println( "FMFileTest: write is bad at " + offset +
": expected = " + (byte)offset + ", actual = " + v );
offset += buffer.remaining( DirectByteBuffer.SS_FILE ) + 1;
break;
}
offset++;
}
}
buffer.position( DirectByteBuffer.SS_FILE, buffer.limit( DirectByteBuffer.SS_FILE ));
}
|
|