Class AZMessageFactory
java.lang.Object
com.biglybt.core.peermanager.messaging.azureus.AZMessageFactory
Factory for handling AZ message creation.
NOTE: wire format: [total message length] + [id length] + [id bytes] + [version byte] + [payload bytes]
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
private static final byte
private static final Map<String,
AZMessageFactory.LegacyData> static final byte
static final byte
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Message
createAZMessage
(DirectByteBuffer stream_payload) Construct a new AZ message instance from the given message raw byte stream.static RawMessage
createAZRawMessage
(Message base_message, int padding_mode) Create the proper AZ raw message from the given base message.static void
init()
Initialize the factory, i.e.static void
Register a generic map payload type with the factory.
-
Field Details
-
MESSAGE_VERSION_INITIAL
public static final byte MESSAGE_VERSION_INITIAL- See Also:
-
MESSAGE_VERSION_SUPPORTS_PADDING
public static final byte MESSAGE_VERSION_SUPPORTS_PADDING- See Also:
-
AZ_HANDSHAKE_PAD_MAX
public static final int AZ_HANDSHAKE_PAD_MAX- See Also:
-
SMALL_PAD_MAX
public static final int SMALL_PAD_MAX- See Also:
-
BIG_PAD_MAX
public static final int BIG_PAD_MAX- See Also:
-
bss
private static final byte bss- See Also:
-
legacy_data
-
-
Constructor Details
-
AZMessageFactory
public AZMessageFactory()
-
-
Method Details
-
init
public static void init()Initialize the factory, i.e. register the messages with the message manager. -
registerGenericMapPayloadMessageType
Register a generic map payload type with the factory.- Parameters:
type_id
- to register- Throws:
MessageException
- on registration error
-
createAZMessage
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
Create the proper AZ raw message from the given base message.- Parameters:
base_message
- to create from- Returns:
- AZ raw message
-