com.aelitis.azureus.core.peermanager.messaging.azureus
Class AZMessageFactory
java.lang.Object
com.aelitis.azureus.core.peermanager.messaging.azureus.AZMessageFactory
public class AZMessageFactory
- extends Object
Factory for handling AZ message creation.
NOTE: wire format: [total message length] + [id length] + [id bytes] + [version byte] + [payload bytes]
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MESSAGE_VERSION_INITIAL
public static final byte MESSAGE_VERSION_INITIAL
- See Also:
- Constant Field Values
MESSAGE_VERSION_SUPPORTS_PADDING
public static final byte MESSAGE_VERSION_SUPPORTS_PADDING
- See Also:
- Constant Field Values
AZ_HANDSHAKE_PAD_MAX
public static final int AZ_HANDSHAKE_PAD_MAX
- See Also:
- Constant Field Values
SMALL_PAD_MAX
public static final int SMALL_PAD_MAX
- See Also:
- Constant Field Values
BIG_PAD_MAX
public static final int BIG_PAD_MAX
- See Also:
- Constant Field Values
AZMessageFactory
public AZMessageFactory()
init
public static void init()
- Initialize the factory, i.e. register the messages with the message manager.
registerGenericMapPayloadMessageType
public static void registerGenericMapPayloadMessageType(String type_id)
throws MessageException
- Register a generic map payload type with the factory.
- Parameters:
type_id
- to register
- Throws:
MessageException
- on registration error
createAZMessage
public static Message createAZMessage(DirectByteBuffer stream_payload)
throws MessageException
- Construct a new AZ message instance from the given message raw byte stream.
- Parameters:
stream_payload
- data
- Returns:
- decoded/deserialized AZ message
- Throws:
MessageException
- if message creation failed.
NOTE: Does not auto-return to buffer pool the given direct buffer on thrown exception.
createAZRawMessage
public static RawMessage createAZRawMessage(Message base_message,
int padding_mode)
- Create the proper AZ raw message from the given base message.
- Parameters:
base_message
- to create from
- Returns:
- AZ raw message