Interface Message
-
- All Known Subinterfaces:
AZMessage
,AZStylePeerExchange
,BTMessage
,LTMessage
,RawMessage
- All Known Implementing Classes:
AZBadPiece
,AZGenericMapPayload
,AZHandshake
,AZHave
,AZMetaData
,AZPeerExchange
,AZRequestHint
,AZStatReply
,AZStatRequest
,BTAllowedFast
,BTBitfield
,BTCancel
,BTChoke
,BTDHTPort
,BTHandshake
,BTHashes
,BTHashReject
,BTHashRequest
,BTHave
,BTHaveAll
,BTHaveNone
,BTInterested
,BTKeepAlive
,BTLTMessage
,BTMessageCancel
,BTMessagePiece
,BTMessageRequest
,BTPiece
,BTRawMessage
,BTRejectRequest
,BTRequest
,BTSuggestPiece
,BTUnchoke
,BTUninterested
,GenericMessage
,HTTPMessage
,LTDisabledExtensionMessage
,LTHandshake
,MessageAdapter
,RawMessageAdapter
,RawMessageImpl
,UTMetaData
,UTPeerExchange
,UTUploadOnly
public interface Message
Basic peer message. A message is uniquely identified by the combination of ID and version.
-
-
Field Summary
Fields Modifier and Type Field Description static int
TYPE_DATA_PAYLOAD
Is a data-bearing message, i.e.static int
TYPE_PROTOCOL_PAYLOAD
Is a protocol-bearing message, i.e.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Message
deserialize(DirectByteBuffer data, byte version)
Create a new instance of this message by decoding the given byte serialization.void
destroy()
Destroy the message; i.e.DirectByteBuffer[]
getData()
Get message payload data.java.lang.String
getDescription()
Get textual description of this particular message.java.lang.String
getFeatureID()
Get the main feature set name this message belongs to.int
getFeatureSubID()
Get the static message sub-id for the feature.java.lang.String
getID()
Get message id.byte[]
getIDBytes()
int
getType()
Get message type.byte
getVersion()
-
-
-
Field Detail
-
TYPE_PROTOCOL_PAYLOAD
static final int TYPE_PROTOCOL_PAYLOAD
Is a protocol-bearing message, i.e. messaging/overhead data.- See Also:
- Constant Field Values
-
TYPE_DATA_PAYLOAD
static final int TYPE_DATA_PAYLOAD
Is a data-bearing message, i.e. file data.- See Also:
- Constant Field Values
-
-
Method Detail
-
getID
java.lang.String getID()
Get message id.- Returns:
- id
-
getIDBytes
byte[] getIDBytes()
-
getFeatureID
java.lang.String getFeatureID()
Get the main feature set name this message belongs to.- Returns:
- feature id
-
getFeatureSubID
int getFeatureSubID()
Get the static message sub-id for the feature.- Returns:
- sub id
-
getVersion
byte getVersion()
-
getType
int getType()
Get message type.- Returns:
- type
-
getDescription
java.lang.String getDescription()
Get textual description of this particular message.- Returns:
- description
-
getData
DirectByteBuffer[] getData()
Get message payload data.- Returns:
- message data buffers
-
deserialize
Message deserialize(DirectByteBuffer data, byte version) throws MessageException
Create a new instance of this message by decoding the given byte serialization.- Parameters:
data
- to deserialize- Returns:
- decoded message instance
- Throws:
MessageException
- if the decoding process fails NOTE: Does not auto-return given direct buffer on thrown exception.
-
destroy
void destroy()
Destroy the message; i.e. perform cleanup actions.
-
-