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 ) < 12 ) {
throw new MessageException( "[" +getID() + "] decode error: payload.remaining[" +data.remaining( DirectByteBuffer.SS_MSG )+ "] < 12" );
}
int id = data.getInt( DirectByteBuffer.SS_MSG );
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 AZSessionPiece( id, 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, 12 );
buffer[0].putInt( DirectByteBuffer.SS_MSG, session_id );
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 = getID()+ " session #" +session_id+ " data for piece #" + piece_number + ":" + piece_offset + "->" + (piece_offset + piece_length -1);
}
return description;
|
public java.lang.String | getFeatureID() throw new RuntimeException( "not implemented" );
|
public int | getFeatureSubID() throw new RuntimeException( "not implemented" );
|
public java.lang.String | getID() return AZMessage.ID_AZ_SESSION_PIECE;
|
public byte[] | getIDBytes() return AZMessage.ID_AZ_SESSION_PIECE_BYTES;
|
public DirectByteBuffer | getPieceData() return buffer[1];
|
public int | getPieceNumber() return piece_number;
|
public int | getPieceOffset() return piece_offset;
|
public int | getSessionID() return session_id;
|
public int | getType() return Message.TYPE_DATA_PAYLOAD;
|
public byte | getVersion() return version;
|