FileDocCategorySizeDatePackage
AZGenericMapPayload.javaAPI DocAzureus 3.0.3.42884Sun Mar 04 21:08:14 GMT 2007com.aelitis.azureus.core.peermanager.messaging.azureus

AZGenericMapPayload

public class AZGenericMapPayload extends Object implements AZMessage
This is a helper class for creating messages with a Map'd beencode-able payload.

Fields Summary
private final byte
version
private DirectByteBuffer
buffer
private final String
type_id
private final Map
msg_map
Constructors Summary
public AZGenericMapPayload(String message_type, Map message, byte version)
Create a new AZ message with the given message type id, with the given bencode-able map payload.

param
message_type of message
param
message payload (to be bencoded)

  
  
                                
           
    this.type_id = message_type;
    this.msg_map = message;
    this.version = version;
  
Methods Summary
public Messagedeserialize(DirectByteBuffer data, byte version)

    Map payload = MessagingUtil.convertBencodedByteStreamToPayload( data, 1, getID() );
    return new AZGenericMapPayload( getID(), payload, version );
  
public voiddestroy()

    if( buffer != null )  buffer.returnToPool();
  
public DirectByteBuffer[]getData()

    if( buffer == null ) {
      buffer = MessagingUtil.convertPayloadToBencodedByteStream( msg_map, DirectByteBuffer.AL_MSG );
    } 
    return new DirectByteBuffer[]{ buffer };
  
public java.lang.StringgetDescription()

   return getID();  
public java.lang.StringgetFeatureID()

  return AZMessage.AZ_FEATURE_ID;  
public intgetFeatureSubID()

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

  return type_id;  
public byte[]getIDBytes()

  return type_id.getBytes();  
public java.util.MapgetMapPayload()

  return msg_map;  
public intgetType()

  return Message.TYPE_PROTOCOL_PAYLOAD;  
public bytegetVersion()

 return version;