}
try{
listener.reportActivity( getMessageText( "report.downloading", contact.getName()));
DistributedDatabaseValue value =
contact.read(
new DistributedDatabaseProgressListener()
{
public void
reportSize(
long size )
{
listener.reportSize( size );
}
public void
reportActivity(
String str )
{
listener.reportActivity( str );
}
public void
reportCompleteness(
int percent )
{
listener.reportCompleteness( percent );
}
},
db.getStandardTransferType( DistributedDatabaseTransferType.ST_TORRENT ),
db.createKey ( hash , "Torrent download content for '" + ByteFormatter.encodeString( hash ) + "'"),
timeout );
if ( value != null ){
// let's verify the torrent
byte[] data = (byte[])value.getValue(byte[].class);
try{
TOTorrent torrent = TOTorrentFactory.deserialiseFromBEncodedByteArray( data );
if ( Arrays.equals( hash, torrent.getHash())){