Methods Summary |
---|
public Message | deserialize(DirectByteBuffer data, byte version)
Map root = MessagingUtil.convertBencodedByteStreamToPayload( data, 20, getID() );
Long id = (Long)root.get( "session_id" );
if( id == null ) throw new MessageException( "id == null" );
int sid = id.intValue();
byte[] hash = (byte[])root.get( "infohash" );
if( hash == null ) throw new MessageException( "hash == null" );
if( hash.length != 20 ) throw new MessageException( "hash.length != 20: " +hash.length );
Map info = (Map)root.get( "info" );
return new AZSessionSyn( hash, sid, info, version );
|
public void | destroy()
if( buffer != null ) buffer.returnToPool();
|
public DirectByteBuffer[] | getData()
if( buffer == null ) {
Map payload_map = new HashMap();
payload_map.put( "session_id", new Long(session_id) );
payload_map.put( "infohash", infohash );
payload_map.put( "info", session_info );
buffer = MessagingUtil.convertPayloadToBencodedByteStream( payload_map, DirectByteBuffer.AL_MSG );
}
return new DirectByteBuffer[]{ buffer };
|
public java.lang.String | getDescription()
if( description == null ) {
description = getID()+ " session id " +session_id+ " for infohash " +ByteFormatter.nicePrint( infohash, true );
}
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_SYN;
|
public byte[] | getIDBytes() return AZMessage.ID_AZ_SESSION_SYN_BYTES;
|
public byte[] | getInfoHash() return infohash;
|
public int | getSessionID() return session_id;
|
public java.util.Map | getSessionInfo() return session_info;
|
public int | getType() return Message.TYPE_PROTOCOL_PAYLOAD;
|
public byte | getVersion() return version;
|