FileDocCategorySizeDatePackage
AZBadPiece.javaAPI DocAzureus 3.0.3.42957Wed Jul 18 11:02:58 BST 2007com.aelitis.azureus.core.peermanager.messaging.azureus

AZBadPiece

public class AZBadPiece extends Object implements AZMessage

Fields Summary
private final byte
version
private org.gudy.azureus2.core3.util.DirectByteBuffer
buffer
private int
piece_number
Constructors Summary
public AZBadPiece(int _piece_number, byte _version)

	
	 
	
				
			 
	
		piece_number	= _piece_number;
		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();

		
		AZBadPiece message =  new AZBadPiece( piece_number, version );
				
		return( message );
	
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 ));
			
			buffer = MessagingUtil.convertPayloadToBencodedByteStream( map, DirectByteBuffer.AL_MSG );
		} 
		
		return new DirectByteBuffer[]{ buffer };
	
public java.lang.StringgetDescription()

   
		
		return( getID() + " " + piece_number );
	
public java.lang.StringgetFeatureID()

		return( AZMessage.AZ_FEATURE_ID );
	
public intgetFeatureSubID()

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

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

		return( AZMessage.ID_AZ_BAD_PIECE_BYTES );		
	
public intgetPieceNumber()

		return( piece_number );
	
public intgetType()

		return( Message.TYPE_PROTOCOL_PAYLOAD );
	
public bytegetVersion()

 return version;