FileDocCategorySizeDatePackage
PRUDPPacketReplyScrape.javaAPI DocAzureus 3.0.3.43125Thu Jan 05 05:43:26 GMT 2006org.gudy.azureus2.core3.tracker.protocol.udp

PRUDPPacketReplyScrape

public class PRUDPPacketReplyScrape extends com.aelitis.net.udp.uc.PRUDPPacketReply
author
parg

Fields Summary
protected static final int
BYTES_PER_ENTRY
protected byte[]
hashes
protected int[]
complete
protected int[]
incomplete
protected int[]
downloaded
Constructors Summary
public PRUDPPacketReplyScrape(int trans_id)

	
	
	
					 
	
		super( PRUDPPacketTracker.ACT_REPLY_SCRAPE, trans_id );
	
protected PRUDPPacketReplyScrape(DataInputStream is, int trans_id)

		super( PRUDPPacketTracker.ACT_REPLY_SCRAPE, trans_id );
		
		// interval = is.readInt();
		
		hashes 		= new byte[is.available()/BYTES_PER_ENTRY][];
		complete	= new int[hashes.length];
		incomplete	= new int[hashes.length];
		downloaded	= new int[hashes.length];
		
		for (int i=0;i<hashes.length;i++){
			
			hashes[i] = new byte[20];
			is.read(hashes[i]);
			complete[i] 	= is.readInt();
			downloaded[i] 	= is.readInt();
			incomplete[i] 	= is.readInt();
		}
	
Methods Summary
public int[]getComplete()

		return( complete );
	
public int[]getDownloaded()

		return( downloaded );
	
public byte[][]getHashes()

		return( hashes );
	
public int[]getIncomplete()

		return( incomplete );
	
public java.lang.StringgetString()

		return( super.getString().concat("[hashes=").concat(String.valueOf(hashes.length)).concat("]") );
		// return( super.getString() + "[interval=" + interval + ", hashes=" + hashes.length + "]" );
	
public voidserialise(java.io.DataOutputStream os)

		super.serialise(os);
		
		// os.writeInt( interval );
		
		if ( hashes != null ){
			
			for (int i=0;i<hashes.length;i++){
				
				os.write( hashes[i] );
				os.writeInt( complete[i] );
				os.writeInt( downloaded[i] );
				os.writeInt( incomplete[i] );
			}
		}
	
public voidsetDetails(byte[][] _hashes, int[] _complete, int[] _downloaded, int[] _incomplete)

		hashes		 	= _hashes;
		complete		= _complete;
		downloaded		= _downloaded;
		incomplete		= _incomplete;