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 id = data.getInt( DirectByteBuffer.SS_MSG );
if( data.remaining( DirectByteBuffer.SS_MSG ) % 4 != 0 ) {
throw new MessageException( "[" +getID() + "] decode error: payload.remaining[" +data.remaining( DirectByteBuffer.SS_MSG )+ "] % 4 != 0" );
}
int[] numbers = new int[ data.remaining( DirectByteBuffer.SS_MSG ) / 4 ];
for( int i=0; i < numbers.length; i++ ) {
numbers[i] = data.getInt( DirectByteBuffer.SS_MSG );
if( numbers[i] < 0 ) {
throw new MessageException( "[" +getID() + "] decode error: number < 0" );
}
}
data.returnToPool();
return new AZSessionHave( id, numbers, version );
|
public void | destroy()
if( buffer != null ) buffer.returnToPool();
|
public DirectByteBuffer[] | getData()
if( buffer == null ) {
buffer = DirectByteBufferPool.getBuffer( DirectByteBuffer.AL_MSG, 4 + (piece_numbers.length*4) );
buffer.putInt( DirectByteBuffer.SS_MSG, session_id );
for( int i=0; i < piece_numbers.length; i++ ) {
buffer.putInt( DirectByteBuffer.SS_MSG, piece_numbers[i] );
}
buffer.flip( DirectByteBuffer.SS_MSG );
}
return new DirectByteBuffer[]{ buffer };
|
public java.lang.String | getDescription()
if( description == null ) {
String numbers = "";
for( int i=0; i < piece_numbers.length; i++ ) {
numbers += " #" +piece_numbers[i];
}
description = getID()+ " session #" +session_id+ " pieces" +numbers;
}
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_HAVE;
|
public byte[] | getIDBytes() return AZMessage.ID_AZ_SESSION_HAVE_BYTES;
|
public int[] | getPieceNumbers() return piece_numbers;
|
public int | getSessionID() return session_id;
|
public int | getType() return Message.TYPE_PROTOCOL_PAYLOAD;
|
public byte | getVersion() return version;
|