Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.Messaging.MessageUtils Class Reference

Diffusion message utilities. More...

Static Public Member Functions

static int GetStaticHeaderLength ()
 Get the static header length. More...
 
static string StringToInternalFormat (string message)
 Takes a String which may contain display representation of special bytes and converts those to actual internal bytes. More...
 
static string StringToDisplayFormat (string message)
 Takes a string which may contain internal message delimiter bytes and converts them to a display format. More...
 
static int GetMessageLength (ByteBuffer buffer)
 Get the message length out of a buffer. More...
 
static void SetMessageLength (ByteBuffer buffer, int length)
 Sets the message buffer's limit to the specified length and also sets the message length field in the buffer. More...
 
static void SetMessageType (ByteBuffer buffer, byte type)
 Sets the message type in a buffer. More...
 
static byte GetMessageType (ByteBuffer buffer)
 Returns the message type from a buffer. More...
 
static string GetMessageType (byte type)
 Returns the message type as a 'human readable' string. More...
 
static void SetMessageEncoding (ByteBuffer buffer, byte encoding)
 Sets the message encoding in a buffer. More...
 
static byte GetMessageEncoding (ByteBuffer buffer)
 Returns the message encoding from a buffer. More...
 
static string GetMessageEncoding (byte encoding)
 Returns the message encoding as a 'human readable' string. More...
 
static void Decode (ByteBuffer input, ByteBuffer output, int headerLength)
 Decodes an input buffer and writes the result to an output buffer. More...
 
static bool Encode (ByteBuffer input, ByteBuffer output, int headerLength)
 Encodes the body part of an input buffer into an output buffer. More...
 
static void CopyMessageHeader (ByteBuffer input, ByteBuffer output, int headerLength)
 Copies the header from one buffer to another. Buffers positions on entry do not matter. The input buffer position is not affected by this operation. On completion, the output buffer position and limit will be the header length. More...
 
static void CopyMessageBody (ByteBuffer inputBuffer, int inputHeaderLength, ByteBuffer buffer, int headerLength)
 Copy the body of one message to another, also setting the encoding. This position of the input buffer is not changed by this operation. The output buffer will be positioned at the end of the data on exit. More...
 
static byte[] GetRemaining (ByteBuffer buffer)
 Gets the remainder of a buffer from the current position into a byte buffer. More...
 
static string GetUntil (ByteBuffer buffer, byte delim)
 
static string[] SplitUntil (ByteBuffer buffer, byte splitDelim, byte untilDelim)
 Splits the incoming byte buffer into an array of strings separated by the 'split' delimiter until hitting the 'until' delimiter. More...
 
static int CalculateMessageCapacity (string topicName, int dataCapacity)
 Calculates the message capacity required for a topic message. This always assumes a full topic name and does not cater for the saving achieved by aliases - so will always overassign space but this is not really a problem. More...
 
static int CalculateInitialMessageSize (int capacity, params string[] headers)
 Calculate the initial size of a message given its initial data capacity and any fixed headers. More...
 

Static Public Attributes

static string fieldDelimiterDisplay = "<FD>"
 The 'human readable' version of a Diffusion field delimiter. More...
 
static string recordDelimiterDisplay = "<RD>"
 The 'human readable' version of a Diffusion record delimiter. More...
 
static string messageDelimiterDisplay = "<MD>"
 The 'human readable' version of a Diffusion message delimiter. More...
 
static string emptyFieldDisplay = "<EF>"
 The 'human readable' version of a Diffusion empty field. More...
 
static char emptyFieldDelimiterChar = (char) 0x03
 Empty field delimiter character. More...
 
static char fieldDelimiterChar = (char) 0x02
 Field delimiter character. More...
 
static char recordDelimiterChar = (char) 0x01
 Record delimiter character. More...
 
static char messageDelimiterChar = (char) 0x00
 Message delimiter character. More...
 
static string emptyFieldDelimiterString
 Empty delimiter character. More...
 
static string fieldDelimiterString
 The string representing a field delimiter. More...
 
static string recordDelimiterString
 The string representing a record delimiter. More...
 
static string messageDelimiterString
 The string representing a message delimiter. More...
 
static int minimumMaxMessageSize = 8
 The (minimum) maximum message size. More...
 

Detailed Description

Diffusion message utilities.

Member Function Documentation

static int PushTechnology.DiffusionCore.Messaging.MessageUtils.CalculateInitialMessageSize ( int  capacity,
params string[]  headers 
)
static

Calculate the initial size of a message given its initial data capacity and any fixed headers.

Parameters
capacity
headers
Returns
static int PushTechnology.DiffusionCore.Messaging.MessageUtils.CalculateMessageCapacity ( string  topicName,
int  dataCapacity 
)
static

Calculates the message capacity required for a topic message. This always assumes a full topic name and does not cater for the saving achieved by aliases - so will always overassign space but this is not really a problem.

Parameters
topicName
dataCapacity
Returns
static void PushTechnology.DiffusionCore.Messaging.MessageUtils.CopyMessageBody ( ByteBuffer  inputBuffer,
int  inputHeaderLength,
ByteBuffer  buffer,
int  headerLength 
)
static

Copy the body of one message to another, also setting the encoding. This position of the input buffer is not changed by this operation. The output buffer will be positioned at the end of the data on exit.

Parameters
inputBuffer
inputHeaderLength
buffer
headerLength
static void PushTechnology.DiffusionCore.Messaging.MessageUtils.CopyMessageHeader ( ByteBuffer  input,
ByteBuffer  output,
int  headerLength 
)
static

Copies the header from one buffer to another. Buffers positions on entry do not matter. The input buffer position is not affected by this operation. On completion, the output buffer position and limit will be the header length.

Parameters
input
output
headerLength
static void PushTechnology.DiffusionCore.Messaging.MessageUtils.Decode ( ByteBuffer  input,
ByteBuffer  output,
int  headerLength 
)
static

Decodes an input buffer and writes the result to an output buffer.

Parameters
input
output
headerLength
static bool PushTechnology.DiffusionCore.Messaging.MessageUtils.Encode ( ByteBuffer  input,
ByteBuffer  output,
int  headerLength 
)
static

Encodes the body part of an input buffer into an output buffer.

Parameters
input
output
headerLength
Returns
static byte PushTechnology.DiffusionCore.Messaging.MessageUtils.GetMessageEncoding ( ByteBuffer  buffer)
static

Returns the message encoding from a buffer.

Parameters
buffer
Returns
static string PushTechnology.DiffusionCore.Messaging.MessageUtils.GetMessageEncoding ( byte  encoding)
static

Returns the message encoding as a 'human readable' string.

Parameters
encoding
Returns
static int PushTechnology.DiffusionCore.Messaging.MessageUtils.GetMessageLength ( ByteBuffer  buffer)
static

Get the message length out of a buffer.

Parameters
buffer
Returns
static byte PushTechnology.DiffusionCore.Messaging.MessageUtils.GetMessageType ( ByteBuffer  buffer)
static

Returns the message type from a buffer.

Parameters
buffer
Returns
static string PushTechnology.DiffusionCore.Messaging.MessageUtils.GetMessageType ( byte  type)
static

Returns the message type as a 'human readable' string.

Parameters
type
Returns
static byte [] PushTechnology.DiffusionCore.Messaging.MessageUtils.GetRemaining ( ByteBuffer  buffer)
static

Gets the remainder of a buffer from the current position into a byte buffer.

Parameters
buffer
Returns
static int PushTechnology.DiffusionCore.Messaging.MessageUtils.GetStaticHeaderLength ( )
static

Get the static header length.

Returns
static string PushTechnology.DiffusionCore.Messaging.MessageUtils.GetUntil ( ByteBuffer  buffer,
byte  delim 
)
static

Parameters
buffer
delim
Returns
static void PushTechnology.DiffusionCore.Messaging.MessageUtils.SetMessageEncoding ( ByteBuffer  buffer,
byte  encoding 
)
static

Sets the message encoding in a buffer.

Parameters
buffer
encoding
static void PushTechnology.DiffusionCore.Messaging.MessageUtils.SetMessageLength ( ByteBuffer  buffer,
int  length 
)
static

Sets the message buffer's limit to the specified length and also sets the message length field in the buffer.

Parameters
buffer
length
static void PushTechnology.DiffusionCore.Messaging.MessageUtils.SetMessageType ( ByteBuffer  buffer,
byte  type 
)
static

Sets the message type in a buffer.

Parameters
buffer
type
static string [] PushTechnology.DiffusionCore.Messaging.MessageUtils.SplitUntil ( ByteBuffer  buffer,
byte  splitDelim,
byte  untilDelim 
)
static

Splits the incoming byte buffer into an array of strings separated by the 'split' delimiter until hitting the 'until' delimiter.

Parameters
buffer
splitDelim
untilDelim
Returns
static string PushTechnology.DiffusionCore.Messaging.MessageUtils.StringToDisplayFormat ( string  message)
static

Takes a string which may contain internal message delimiter bytes and converts them to a display format.

Parameters
message
Returns
static string PushTechnology.DiffusionCore.Messaging.MessageUtils.StringToInternalFormat ( string  message)
static

Takes a String which may contain display representation of special bytes and converts those to actual internal bytes.

Parameters
message
Returns

Member Data Documentation

char PushTechnology.DiffusionCore.Messaging.MessageUtils.emptyFieldDelimiterChar = (char) 0x03
static

Empty field delimiter character.

string PushTechnology.DiffusionCore.Messaging.MessageUtils.emptyFieldDelimiterString
static
Initial value:
=
Convert.ToString(emptyFieldDelimiterChar)

Empty delimiter character.

string PushTechnology.DiffusionCore.Messaging.MessageUtils.emptyFieldDisplay = "<EF>"
static

The 'human readable' version of a Diffusion empty field.

char PushTechnology.DiffusionCore.Messaging.MessageUtils.fieldDelimiterChar = (char) 0x02
static

Field delimiter character.

string PushTechnology.DiffusionCore.Messaging.MessageUtils.fieldDelimiterDisplay = "<FD>"
static

The 'human readable' version of a Diffusion field delimiter.

string PushTechnology.DiffusionCore.Messaging.MessageUtils.fieldDelimiterString
static
Initial value:
=
Convert.ToString(fieldDelimiterChar)

The string representing a field delimiter.

char PushTechnology.DiffusionCore.Messaging.MessageUtils.messageDelimiterChar = (char) 0x00
static

Message delimiter character.

string PushTechnology.DiffusionCore.Messaging.MessageUtils.messageDelimiterDisplay = "<MD>"
static

The 'human readable' version of a Diffusion message delimiter.

string PushTechnology.DiffusionCore.Messaging.MessageUtils.messageDelimiterString
static
Initial value:
=
Convert.ToString(messageDelimiterChar)

The string representing a message delimiter.

int PushTechnology.DiffusionCore.Messaging.MessageUtils.minimumMaxMessageSize = 8
static

The (minimum) maximum message size.

char PushTechnology.DiffusionCore.Messaging.MessageUtils.recordDelimiterChar = (char) 0x01
static

Record delimiter character.

string PushTechnology.DiffusionCore.Messaging.MessageUtils.recordDelimiterDisplay = "<RD>"
static

The 'human readable' version of a Diffusion record delimiter.

string PushTechnology.DiffusionCore.Messaging.MessageUtils.recordDelimiterString
static
Initial value:
=
Convert.ToString(recordDelimiterChar)

The string representing a record delimiter.