FileDocCategorySizeDatePackage
AZRequestHint.javaAPI DocAzureus 3.0.3.43644Sun Mar 04 21:08:14 GMT 2007com.aelitis.azureus.core.peermanager.messaging.azureus

AZRequestHint

public class AZRequestHint extends Object implements AZMessage

Fields Summary
private final byte
version
private org.gudy.azureus2.core3.util.DirectByteBuffer
buffer
private int
piece_number
private int
offset
private int
length
private int
life
Constructors Summary
public AZRequestHint(int _piece_number, int _offset, int _length, int _life, byte _version)

	
	 
	
				
				
				
				
			 
	
		piece_number	= _piece_number;
		offset			= _offset;
		length			= _length;
		life			= _life;
		version			= _version;
	
Methods Summary
public com.aelitis.azureus.core.peermanager.messaging.Messagedeserialize(org.gudy.azureus2.core3.util.DirectByteBuffer data, byte version)

		Map payload = MessagingUtil.convertBencodedByteStreamToPayload( data, 1, getID() );
					
		int	piece_number	= ((Long)payload.get( "piece")).intValue();
		int	offset			= ((Long)payload.get( "offset")).intValue();
		int	length			= ((Long)payload.get( "length")).intValue();
		int	life			= ((Long)payload.get( "life" )).intValue();
		
		return( new AZRequestHint( piece_number, offset, length, life, version ));
	
public voiddestroy()

	
		if ( buffer != null ){
			
			buffer.returnToPool();
		}
	
public org.gudy.azureus2.core3.util.DirectByteBuffer[]getData()

		if ( buffer == null ){
			
			Map	map = new HashMap();
			
			map.put( "piece", new Long( piece_number ));
			map.put( "offset", new Long( offset ));
			map.put( "length", new Long( length ));
			map.put( "life", new Long( life ));
			
			buffer = MessagingUtil.convertPayloadToBencodedByteStream( map, DirectByteBuffer.AL_MSG );
		} 
		
		return new DirectByteBuffer[]{ buffer };
	
public java.lang.StringgetDescription()

   
		return( getID() + " piece #" + piece_number + ":" + offset + "->" + (offset + length -1) + "/" + life );
	
public java.lang.StringgetFeatureID()

		return( AZMessage.AZ_FEATURE_ID );
	
public intgetFeatureSubID()

		return( AZMessage.SUBID_ID_AZ_REQUEST_HINT );		
	
public java.lang.StringgetID()

		return( AZMessage.ID_AZ_REQUEST_HINT );
	
public byte[]getIDBytes()

		return( AZMessage.ID_AZ_REQUEST_HINT_BYTES );		
	
public intgetLength()

		return( length );
	
public intgetLife()

		return( life );
	
public intgetOffset()

		return( offset );
	
public intgetPieceNumber()

		return( piece_number );
	
public intgetType()

		return( Message.TYPE_PROTOCOL_PAYLOAD );
	
public bytegetVersion()

 return version;