Methods Summary |
---|
public com.aelitis.azureus.core.peermanager.messaging.Message | deserialize(DirectByteBuffer data, byte version)
if( data == null ) {
throw new MessageException( "[" +getID() + "] decode error: data == null" );
}
if( data.remaining( DirectByteBuffer.SS_MSG ) < 8 ) {
throw new MessageException( "[" +getID()+ "] decode error: payload.remaining[" +data.remaining( DirectByteBuffer.SS_MSG )+ "] < 8" );
}
int number = data.getInt( DirectByteBuffer.SS_MSG );
if( number < 0 ) {
throw new MessageException( "[" +getID() +"] decode error: number < 0" );
}
int offset = data.getInt( DirectByteBuffer.SS_MSG );
if( offset < 0 ) {
throw new MessageException( "[" +getID() + "] decode error: offset < 0" );
}
return new BTPiece( number, offset, data, version );
|
public void | destroy()
if( buffer[0] != null ) buffer[0].returnToPool();
if( buffer[1] != null ) buffer[1].returnToPool();
|
public DirectByteBuffer[] | getData()
if( buffer[0] == null ) {
buffer[0] = DirectByteBufferPool.getBuffer( DirectByteBuffer.AL_MSG_BT_PIECE, 8 );
buffer[0].putInt( DirectByteBuffer.SS_MSG, piece_number );
buffer[0].putInt( DirectByteBuffer.SS_MSG, piece_offset );
buffer[0].flip( DirectByteBuffer.SS_MSG );
}
return buffer;
|
public java.lang.String | getDescription()
if( description == null ) {
description = BTMessage.ID_BT_PIECE + " data for piece #" + piece_number + ":" + piece_offset + "->" + (piece_offset + piece_length -1);
}
return description;
|
public java.lang.String | getFeatureID() return BTMessage.BT_FEATURE_ID;
|
public int | getFeatureSubID() return BTMessage.SUBID_BT_PIECE;
|
public java.lang.String | getID() return BTMessage.ID_BT_PIECE;
|
public byte[] | getIDBytes() return BTMessage.ID_BT_PIECE_BYTES;
|
public DirectByteBuffer | getPieceData() return buffer[1];
|
public int | getPieceNumber() return piece_number;
|
public int | getPieceOffset() return piece_offset;
|
public int | getType() return Message.TYPE_DATA_PAYLOAD;
|
public byte | getVersion() return version;
|