Class AZMessageFactory
- java.lang.Object
-
- com.biglybt.core.peermanager.messaging.azureus.AZMessageFactory
-
public class AZMessageFactory extends java.lang.Object
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 Modifier and Type Class Description protected static class
AZMessageFactory.LegacyData
-
Field Summary
Fields Modifier and Type Field Description static int
AZ_HANDSHAKE_PAD_MAX
static int
BIG_PAD_MAX
private static byte
bss
private static java.util.Map<java.lang.String,AZMessageFactory.LegacyData>
legacy_data
static byte
MESSAGE_VERSION_INITIAL
static byte
MESSAGE_VERSION_SUPPORTS_PADDING
static int
SMALL_PAD_MAX
-
Constructor Summary
Constructors Constructor Description AZMessageFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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
registerGenericMapPayloadMessageType(java.lang.String type_id)
Register a generic map payload type with the factory.
-
-
-
Field Detail
-
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
-
bss
private static final byte bss
- See Also:
- Constant Field Values
-
legacy_data
private static final java.util.Map<java.lang.String,AZMessageFactory.LegacyData> legacy_data
-
-
Method Detail
-
init
public static void init()
Initialize the factory, i.e. register the messages with the message manager.
-
registerGenericMapPayloadMessageType
public static void registerGenericMapPayloadMessageType(java.lang.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
-
-