C# Class Brod.Messages.Message

Afficher le fichier Open project: paralect/brod Class Usage Examples

Méthodes publiques

Méthode Description
CalculateMessageLength ( Int32 payloadLength ) : Int32

Calculate message length based on payload length

CalculateOnDiskMessageLength ( Int32 payloadLength ) : Int32

Calculate "on-disk" message length based on payload length. It differ from CalculateMessageLengh by additional 4 bytes that occupied by message lengh Int32 value

CalculatePayloadLength ( Int32 messageLength ) : Int32

Calculate payload length based on message length

CreateMessage ( byte payload ) : Message

Factory method for creating message with payload

Validate ( ) : void

Validate message by computing CRC32 hash for payload and comparing with Crc property. Throws exception if validation fails.

Private Methods

Méthode Description
ByteArraysEqual ( byte b1, byte b2 ) : bool

Trivial, yet efficient, byte array comparison

Method Details

CalculateMessageLength() public static méthode

Calculate message length based on payload length
public static CalculateMessageLength ( Int32 payloadLength ) : Int32
payloadLength System.Int32
Résultat System.Int32

CalculateOnDiskMessageLength() public static méthode

Calculate "on-disk" message length based on payload length. It differ from CalculateMessageLengh by additional 4 bytes that occupied by message lengh Int32 value
public static CalculateOnDiskMessageLength ( Int32 payloadLength ) : Int32
payloadLength System.Int32
Résultat System.Int32

CalculatePayloadLength() public static méthode

Calculate payload length based on message length
public static CalculatePayloadLength ( Int32 messageLength ) : Int32
messageLength System.Int32
Résultat System.Int32

CreateMessage() public static méthode

Factory method for creating message with payload
public static CreateMessage ( byte payload ) : Message
payload byte
Résultat Message

Validate() public méthode

Validate message by computing CRC32 hash for payload and comparing with Crc property. Throws exception if validation fails.
public Validate ( ) : void
Résultat void