FileDocCategorySizeDatePackage
AZSessionBitfield.javaAPI DocAzureus 3.0.3.43283Sun Mar 04 21:08:16 GMT 2007com.aelitis.azureus.core.peermanager.messaging.azureus.session

AZSessionBitfield

public class AZSessionBitfield extends Object implements com.aelitis.azureus.core.peermanager.messaging.azureus.AZMessage
Torrent session bitfield message.

Fields Summary
private final byte
version
private final DirectByteBuffer
bitfield
private final int
session_id
Constructors Summary
public AZSessionBitfield(int session_id, DirectByteBuffer bitfield, byte version)

    this.session_id = session_id;
    this.bitfield = bitfield;
    this.version = version;
  
Methods Summary
public com.aelitis.azureus.core.peermanager.messaging.Messagedeserialize(DirectByteBuffer data, byte version)

    
    if( data == null ) {
      throw new MessageException( "[" +getID()+ "] decode error: data == null" );
    }
        
    if( data.remaining( DirectByteBuffer.SS_MSG ) < 4 ) {
      throw new MessageException( "[" +getID() + "] decode error: payload.remaining[" +data.remaining( DirectByteBuffer.SS_MSG )+ "] < 4" );
    }
    
    int id = data.getInt( DirectByteBuffer.SS_MSG );
    
    return new AZSessionBitfield( id, data, version );
  
public voiddestroy()

    if( bitfield != null )  bitfield.returnToPool();
  
public DirectByteBuffergetBitfield()

  return bitfield;  
public DirectByteBuffer[]getData()

    DirectByteBuffer sess = DirectByteBufferPool.getBuffer( DirectByteBuffer.AL_MSG, 4 );
    sess.putInt( DirectByteBuffer.SS_MSG, session_id );
    sess.flip( DirectByteBuffer.SS_MSG );
    
    return new DirectByteBuffer[]{ sess, bitfield };
  
public java.lang.StringgetDescription()

  return getID() +" session #"+ session_id;  
public java.lang.StringgetFeatureID()

  throw new RuntimeException( "not implemented" );  
public intgetFeatureSubID()

  throw new RuntimeException( "not implemented" );  
public java.lang.StringgetID()

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

  return AZMessage.ID_AZ_SESSION_BITFIELD_BYTES;  
public intgetSessionID()

  return session_id; 
public intgetType()

  return Message.TYPE_PROTOCOL_PAYLOAD;  
public bytegetVersion()

 return version;