com.aelitis.azureus.core.peermanager.messaging
Class MessagingUtil

java.lang.Object
  extended by com.aelitis.azureus.core.peermanager.messaging.MessagingUtil

public class MessagingUtil
extends Object


Constructor Summary
MessagingUtil()
           
 
Method Summary
static Map convertBencodedByteStreamToPayload(DirectByteBuffer stream, int min_size, String id)
          Convert the given bencoded byte stream into a message map.
static DirectByteBuffer convertPayloadToBencodedByteStream(Map payload, byte alloc_id)
          Convert the given message payload map to a bencoded byte stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagingUtil

public MessagingUtil()
Method Detail

convertPayloadToBencodedByteStream

public static DirectByteBuffer convertPayloadToBencodedByteStream(Map payload,
                                                                  byte alloc_id)
Convert the given message payload map to a bencoded byte stream.

Parameters:
payload - to convert
Returns:
bencoded serialization

convertBencodedByteStreamToPayload

public static Map convertBencodedByteStreamToPayload(DirectByteBuffer stream,
                                                     int min_size,
                                                     String id)
                                              throws MessageException
Convert the given bencoded byte stream into a message map.

Parameters:
stream - to convert
min_size - of stream
id - of message
Returns:
mapped deserialization
Throws:
MessageException - on convertion error NOTE: Does not auto-return given direct buffer on thrown exception.