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

This is the implementation of the API DataMessage which is a message that has a data body. More...

Inheritance diagram for PushTechnology.DiffusionCore.Messaging.DataMessageImpl:
PushTechnology.DiffusionCore.Messaging.MessageImpl PushTechnology.DiffusionCore.Messaging.MessageBase PushTechnology.DiffusionCore.Messaging.IMessageComparable PushTechnology.DiffusionCore.Messaging.Topic.TopicMessageImpl PushTechnology.DiffusionCore.Messaging.DeltaMessage PushTechnology.DiffusionCore.Messaging.DeltaMessageAck PushTechnology.DiffusionCore.Messaging.FetchReplyMessage PushTechnology.DiffusionCore.Messaging.Topic.TopicLoadMessage PushTechnology.DiffusionCore.Messaging.TopicLoadMessageAck PushTechnology.DiffusionCore.Messaging.CommandMessage PushTechnology.DiffusionCore.Messaging.CommandNotificationMessage PushTechnology.DiffusionCore.Messaging.CommandLoadMessage

Public Member Functions

 DataMessageImpl (byte type, long initialSize)
 Constructor. More...
 
 DataMessageImpl (IExternalMessage message)
 Constructor. More...
 
 DataMessageImpl (byte type)
 Constructor for new messages. Subclasses with headers must call SetFixedHeaders in their constructor. More...
 
 DataMessageImpl (byte type, ByteBuffer buffer, IMessageHeaderTransformer headerTransformer)
 Constructor for message created from inbound byte buffers. The supplied buffer will be copied and its position or limit will be unaffected. More...
 
override int Size ()
 Return the size of this message. More...
 
override int Capacity ()
 Return the capacity of this message. More...
 
override void AddFixedHeader (string header)
 Adds a fixed header to this message. More...
 
override string ToString ()
 
override int GetMessageLength ()
 Returns the total message length including headers. Note that for an encoded data message this will return the encoded message length. More...
 
override ByteBuffer GetBufferForWriting (ConnectionCapabilities capabilities)
 Returns the message in buffer format for writing. If the message is encoded or needs encoding then this will return the encoded version. However, if the supplied capabilities indicate that the caller can not handled the encoded version then the unencoded version would be returned. More...
 
ByteBuffer GetBufferForReading ()
 Get a buffer for reading. More...
 
override bool IsDataMessage ()
 
override void SetHeaders (List< string > headers)
 Sets the headers. More...
 
override void SetHeaders (params string[] headers)
 Sets the headers. More...
 
void SetEncoding (byte encoding)
 Sets the byte encoding for the message and encodes it. More...
 
void Rewind ()
 Rewinds the message pointer to the start of the data portion, leaving the message limit as before. This prepares the buffer for reading after being written. More...
 
void Put (ByteBuffer buffer)
 Relative put of data from a ByteBuffer. More...
 
int BufferPosition ()
 Used for getting the current position of the readable buffer. More...
 
void BufferPosition (int position)
 Used for setting the position of the readable buffer. More...
 
void Put (byte data)
 Relative put of a single byte of data. More...
 
void Put (byte[] data)
 Relative put of a byte array of data. More...
 
void Put (params string[] data)
 Relative put of string data. Converts supplied string(s) to bytes using the messages character set encoding and puts the bytes into the message starting from the current position. Multiple strings are concatenated. More...
 
void Put (IDataMessage message)
 Puts the entire contents of another message into this message. More...
 
void PutRecord (params string[] fields)
 Relative put of a set of string fields as a record. The specified fields are written to the message delimited by field delimiters. If there is already data in the buffer that is not terminated by a record delimiter, then a record delimiter will first be written to the message. More...
 
void PutRecord (params byte[] fields)
 Relative put of a set of byte array fields as a record. The specified fields are written to the message delimited by field delimiters. If there is already data in the buffer that is not terminated by a record delimiter, then a record delimiter will first be written to the message. More...
 
void PutRecords (params Record[] records)
 Relative put of one or more records. The fields of each record are written to the message delimited by field delimiters and the records themselves are delimited by record delimiters, strings are converted to bytes using the character set of the message. The message pointer is then updated. If there is already data in the buffer that is not terminated by a record delimiter, then a record delimiter will first be written to the message. Record delimiters will then be written at the start of each subsequent record. Null entries are interpreted as empty records. More...
 
void PutRecords (List< Record > records)
 Relative put of one or more records from a collection. More...
 
void PutFields (string[] fields)
 Relative put of one or more string fields. If there is already data in the buffer which is not terminated by a record or field delimiter, then a field delimiter will be written followed by the specified fields separated by field delimiters. More...
 
void PutFields (params byte[] fields)
 Relative put of one or more byte array fields. Puts the bytes into the message starting from the current position. Multiple fields are separated by field delimiters. The message position is then updated. If there is already data in the buffer which is not terminated by a record or field delimiter, then a field delimiter will be written followed by the specified fields separated by field delimiters. If any field value is null it will be written as an empty field. More...
 
string AsString ()
 Returns the whole message body as a string. The message's character set will be used to convert the message bytes to a string. More...
 
byte[] AsBytes ()
 Returns the whole message as a byte array. More...
 
ByteBuffer AsByteBuffer ()
 Returns the whole message data content as a newly allocated ByteBuffer. This operation does not affect the message pointer. More...
 
List< string > AsFields ()
 Returns the whole message body as fields. Fields are delimited by field delimiters. If there are no such delimiters then a single field would be returned. The message's character set will be used to convert the message bytes to a string. This operation does not affect the message pointer. More...
 
List< RecordAsRecords ()
 Returns the whole message body as records. Records are delimited by record delimiters. If there are no such delimiters then a single record would be returned. This operation does not affect the message pointer. More...
 
List< RecordAsRecords (IMRecord metadata)
 Returns the whole message body as records. This is similar to AsRecords() except that the structure of the supplied metadata is assumed for each record and the records returned can be accessed using metadata specific methods. More...
 
string MessageDetails ()
 Returns the details of the message in 'L=...,T=...,E=...' format. More...
 
int Available ()
 Indicates the free space available for writing to in bytes. If the message is in a read only state then this will return 0. If the message is writable then this will return the number of bytes of bytes of data that may be written before the message becomes full. It is important to note that this returns the number of free bytes and not necessarily the number of characters that may be written as depending upon the character set in use the number of bytes required to write a character may vary. More...
 
byte NextByte ()
 Returns the next byte of data from the message. More...
 
byte NextByte (ByteBuffer buffer)
 Next byte in buffer. More...
 
void NextBytes (byte[] destination)
 Returns data from the message as bytes from the current position. More...
 
void NextBytes (ByteBuffer buffer, byte[] destination)
 Next bytes in buffer. More...
 
Record NextRecord ()
 Relative get of a record of string data. More...
 
Record NextRecord (IMRecord metadata)
 Returns a record of string data from the current message position using a metadata definition. This is similar to NextRecord() except the the structure of the supplied metadata is assumed for the record and the record returned can be accessed using metadata-specific methods. More...
 
Record NextRecord (ByteBuffer buffer, IMRecord metadata)
 Returns the next record in the buffer. More...
 
string NextField (ByteBuffer buffer)
 Return the next field from a byte buffer. More...
 
string NextField ()
 Relative get of a field of string data. More...
 
void PutObject (object obj)
 Writes an object to the message using object serialization. More...
 
void WriteToHttpBuffer (ByteBuffer buffer)
 Writes the message to an HTTP output buffer in the correct format. The buffer must be correctly positioned with sufficient limit. More...
 
void SetBodyFromMessage (DataMessageImpl message)
 Sets the body of this message from another message. This is only to be used during construction. The encoded state is also copied so the buffer state of the input message is copied to this message leaving this message in the same encoding state as the source message. More...
 
bool Encode ()
 Encodes the message (if it needs it). returns true if encoded (or already encoded) or false if encoding was not necessary. More...
 
void Decode (bool keepEncoded)
 Decodes the message. More...
 
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 
- Public Member Functions inherited from PushTechnology.DiffusionCore.Messaging.MessageImpl
override bool IsTopicMessage ()
 
override List< string > GetHeaders ()
 Get the headers of this message. More...
 
override string GetHeader (int index)
 Returns a header value. More...
 
override void SetHeaders (params string[] headers)
 Sets headers. One or more separate headers may be set as required. Headers may be set once and only once after constructing a message and before any data is added to the message. More...
 
override void SetHeaders (List< string > headers)
 Set the headers of this message. More...
 
override int CompareTo (IMessage message)
 Compares the current object with another object of the same type. More...
 
override int CompareTo (IMessage message, MessageComparator comparator)
 Compares this message to another message using a specified comparator. More...
 
override bool Equals (object obj)
 
override int GetHashCode ()
 
virtual bool IsControlMessage ()
 
void Write (ByteBuffer buffer, ConnectionCapabilities capabilities)
 Write the message to a byte buffer. More...
 
void Write (SslStream stream)
 Writes the message to a secure stream. More...
 
void Write (ClientSocket socket)
 Write the message to a socket channel. More...
 
void Write (SslStream stream, ConnectionCapabilities capabilities, bool async)
 Write the message to a secure stream. More...
 
void Write (ClientSocket socket, ConnectionCapabilities capabilities)
 Write the message to a socket channel. More...
 
- Public Member Functions inherited from PushTechnology.DiffusionCore.Messaging.MessageBase
virtual bool IsAckRequired ()
 

Protected Member Functions

 DataMessageImpl (byte type, int capacity)
 Constructor. More...
 
 DataMessageImpl (byte type, int capacity, MessageEncodingType?encoding)
 Constructor for new messages. Subclasses with headers must call SetHeaders in their constructor. More...
 
void SetFixedHeaders (TopicAliasMap topicAliasMap, params string[] headers)
 Sets headers allowing for transformation of the topic name. More...
 
override void SetFixedHeaders (params string[] headers)
 Sets the fixed header fields. This is only called during the construction of a new message. More...
 
- Protected Member Functions inherited from PushTechnology.DiffusionCore.Messaging.MessageImpl
 MessageImpl (IExternalMessage message)
 Constructor. More...
 
 MessageImpl (byte type)
 Constructor for new messages. More...
 
 MessageImpl (byte type, ByteBuffer buffer, IMessageHeaderTransformer headerTransformer)
 Constructor for messages created from an incoming message buffer. For message types with headers this unpacks the header values and calls down to the ApplyHeaderValues method to capture and validate the headers. Any values required must be copied from the supplied buffer which should remain untouched. Also the message length must be determined from the length in the buffer rather than the buffer limit which could be longer. More...
 
void SetHeaderLength ()
 Sets the header length according to the sum of the current headers plus delimiters plus static header length. More...
 
List< string > GetAllHeaders ()
 Gets all headers (fixed and user). More...
 
virtual int GetNumberOfFixedHeaders ()
 Returns the number of fixed headers that the message has (must have). More...
 
virtual void ApplyFixedHeaders (List< string > headers, IMessageHeaderTransformer headerTransformer)
 This is used for messages that have headers when a message is created from an existing byte buffer. This is called during construction so that the subclasses can capture and validate the header field values. More...
 
virtual string GetAckId ()
 

Properties

override byte MessageType [get, set]
 Get/set the type of this message. More...
 
ByteBuffer InternalBuffer [get]
 Provides public access to the underlying byte buffer. Primarily for debugging purposes. More...
 
string Charset [get, set]
 Returns the character set to be used by the message for byte/character conversions. More...
 
bool HasRemaining [get]
 Indicates whether the message has any remaining data to read. More...
 
int Remaining [get]
 Indicates the number of unread data bytes remaining within the message. More...
 
int Length [get]
 Returns the length of the data within the message. More...
 
byte TheEncoding [get]
 Returns the message encoding. More...
 
IMessageReader Reader [get]
 This returns a reader which may be used to perform relative read operations on a message without affecting the pointers of the original message. More...
 
DataMessageInputStream InputStream [get]
 Returns a binary reader which may be used for reading bytes from the message. More...
 
DataMessageOutputStream OutputStream [get]
 Returns a binary writer which may be used for writing bytes to the message. More...
 
- Properties inherited from PushTechnology.DiffusionCore.Messaging.MessageImpl
int HeaderLength [get, set]
 Returns the length of the header. More...
 
bool SetMessageLengthOnWrite [get, set]
 Determines whether we set the message length explicitly prior to writing. More...
 
virtual byte MessageType [get, set]
 Get/set the type of this message. More...
 
bool HasHeaders [get]
 Does this message have headers? More...
 
byte Priority [get, set]
 Get/set the priority of this message. More...
 
bool IsExpedited [get, set]
 Get/set whether this message should be expedited. More...
 
List< string > FixedHeaders [get]
 Returns the collection of fixed headers. More...
 
string AckId [get, set]
 Get/set the acknowledgement id. More...
 
int DataPosition [get, set]
 Get/set the data position. Only useful when initialising from buffer. More...
 
override long Timestamp [get, set]
 Get/set the timestamp of this message. More...
 
override bool IsLocked [get, set]
 Get/set whether this message is locked. More...
 
bool HasUserHeaders [get]
 Returns whether this message has user headers. More...
 
- Properties inherited from PushTechnology.DiffusionCore.Messaging.MessageBase
abstract long Timestamp [get, set]
 
abstract bool IsLocked [get, set]
 

Additional Inherited Members

- Static Public Attributes inherited from PushTechnology.DiffusionCore.Messaging.MessageBase
static byte MESSAGE_DELIMITER
 Message delimiter. More...
 
static char MESSAGE_DELIMITER_CHAR = (char) 0x00
 Message delimiter character. More...
 
static byte RECORD_DELIMITER = 0x01
 Record delimiter. More...
 
static char RECORD_DELIMITER_CHAR = (char) 0x01
 Record delimiter character. More...
 
static byte FIELD_DELIMITER = 0x02
 Field delimiter. More...
 
static char FIELD_DELIMITER_CHAR = (char) 0x02
 Field delimiter character. More...
 
static byte MESSAGE_SEPARATOR = 0x08
 Message separator. More...
 
static char MESSAGE_SEPARATOR_CHAR = (char) 0x08
 Message separator character. More...
 
static char EMPTY_FIELD_CHAR = (char) 0x03
 Empty field character. More...
 
static string EMPTY_FIELD_STRING = EMPTY_FIELD_CHAR.ToString(CultureInfo.InvariantCulture)
 Empty field string. More...
 
static byte LIST_DELIMITER = 0x06
 Byte value reserved for use as a list delimiter used for separating the elements of a list in character-based messages. More...
 
static char LIST_DELIMITER_CHAR = (char) LIST_DELIMITER
 Character representation of LIST_DELIMITER. More...
 
static string LIST_DELIMITER_STRING = LIST_DELIMITER_CHAR.ToString(CultureInfo.InvariantCulture)
 String representation of LIST_DELIMITER. Useful for string.Join operations. More...
 
- Static Protected Member Functions inherited from PushTechnology.DiffusionCore.Messaging.MessageImpl
static void CheckHeaders (int length, params string[] headers)
 Utility method to check that the correct number of headers have been supplied. More...
 
- Protected Attributes inherited from PushTechnology.DiffusionCore.Messaging.MessageImpl
List< string > theUserHeaders
 User headers. More...
 

Detailed Description

This is the implementation of the API DataMessage which is a message that has a data body.

Constructor & Destructor Documentation

PushTechnology.DiffusionCore.Messaging.DataMessageImpl.DataMessageImpl ( byte  type,
long  initialSize 
)

Constructor.

Parameters
type
initialSize
PushTechnology.DiffusionCore.Messaging.DataMessageImpl.DataMessageImpl ( IExternalMessage  message)

Constructor.

Parameters
message
PushTechnology.DiffusionCore.Messaging.DataMessageImpl.DataMessageImpl ( byte  type,
int  capacity 
)
protected

Constructor.

Parameters
type
capacity
PushTechnology.DiffusionCore.Messaging.DataMessageImpl.DataMessageImpl ( byte  type,
int  capacity,
MessageEncodingType encoding 
)
protected

Constructor for new messages. Subclasses with headers must call SetHeaders in their constructor.

Parameters
type
capacity
encoding
PushTechnology.DiffusionCore.Messaging.DataMessageImpl.DataMessageImpl ( byte  type)

Constructor for new messages. Subclasses with headers must call SetFixedHeaders in their constructor.

Parameters
type
PushTechnology.DiffusionCore.Messaging.DataMessageImpl.DataMessageImpl ( byte  type,
ByteBuffer  buffer,
IMessageHeaderTransformer  headerTransformer 
)

Constructor for message created from inbound byte buffers. The supplied buffer will be copied and its position or limit will be unaffected.

Parameters
type
buffer
headerTransformer

Member Function Documentation

override void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.AddFixedHeader ( string  header)
virtual

Adds a fixed header to this message.

Parameters
header

summary>

        Returns a <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.

        /summary>

        returns>

        A <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.

        /returns>
        filterpriority>2</filterpriority>  

Reimplemented from PushTechnology.DiffusionCore.Messaging.MessageImpl.

ByteBuffer PushTechnology.DiffusionCore.Messaging.DataMessageImpl.AsByteBuffer ( )

Returns the whole message data content as a newly allocated ByteBuffer. This operation does not affect the message pointer.

Returns
The data content of the message as a (decoded) byte buffer.
byte [] PushTechnology.DiffusionCore.Messaging.DataMessageImpl.AsBytes ( )

Returns the whole message as a byte array.

Returns
List<string> PushTechnology.DiffusionCore.Messaging.DataMessageImpl.AsFields ( )

Returns the whole message body as fields. Fields are delimited by field delimiters. If there are no such delimiters then a single field would be returned. The message's character set will be used to convert the message bytes to a string. This operation does not affect the message pointer.

Returns
The data content of the message as a list of fields.
List<Record> PushTechnology.DiffusionCore.Messaging.DataMessageImpl.AsRecords ( )

Returns the whole message body as records. Records are delimited by record delimiters. If there are no such delimiters then a single record would be returned. This operation does not affect the message pointer.

Returns
The data content of the message as a list of records.
List<Record> PushTechnology.DiffusionCore.Messaging.DataMessageImpl.AsRecords ( IMRecord  metadata)

Returns the whole message body as records. This is similar to AsRecords() except that the structure of the supplied metadata is assumed for each record and the records returned can be accessed using metadata specific methods.

Parameters
metadataThe metadata that defines each record. This must either be a simple IMRecord definition or an IMMessage which defines a single record. The data type of the metadata must be RECORD.
Returns
The data content of the message as a list of records.
string PushTechnology.DiffusionCore.Messaging.DataMessageImpl.AsString ( )

Returns the whole message body as a string. The message's character set will be used to convert the message bytes to a string.

Returns
int PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Available ( )

Indicates the free space available for writing to in bytes. If the message is in a read only state then this will return 0. If the message is writable then this will return the number of bytes of bytes of data that may be written before the message becomes full. It is important to note that this returns the number of free bytes and not necessarily the number of characters that may be written as depending upon the character set in use the number of bytes required to write a character may vary.

Returns
int PushTechnology.DiffusionCore.Messaging.DataMessageImpl.BufferPosition ( )

Used for getting the current position of the readable buffer.

Returns
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.BufferPosition ( int  position)

Used for setting the position of the readable buffer.

Parameters
position
override int PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Capacity ( )
virtual

Return the capacity of this message.

Returns

Implements PushTechnology.DiffusionCore.Messaging.MessageBase.

void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Decode ( bool  keepEncoded)

Decodes the message.

Parameters
keepEncodedindicates whether we should keep the encoded version (which you might do if you just wanted to read the message but then send it out again, thus avoiding re-encoding) or discard the encoded version (which would be best if do not plan to send the message out again as it will save space).
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Dispose ( )

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

<filterpriority>2</filterpriority>

bool PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Encode ( )

Encodes the message (if it needs it). returns true if encoded (or already encoded) or false if encoding was not necessary.

Returns
ByteBuffer PushTechnology.DiffusionCore.Messaging.DataMessageImpl.GetBufferForReading ( )

Get a buffer for reading.

Returns
A new buffer positioned after the header.
override ByteBuffer PushTechnology.DiffusionCore.Messaging.DataMessageImpl.GetBufferForWriting ( ConnectionCapabilities  capabilities)
virtual

Returns the message in buffer format for writing. If the message is encoded or needs encoding then this will return the encoded version. However, if the supplied capabilities indicate that the caller can not handled the encoded version then the unencoded version would be returned.

Parameters
capabilitiescapabilities or null indicating ALL capabilities.
Returns

Implements PushTechnology.DiffusionCore.Messaging.MessageImpl.

override int PushTechnology.DiffusionCore.Messaging.DataMessageImpl.GetMessageLength ( )
virtual

Returns the total message length including headers. Note that for an encoded data message this will return the encoded message length.

Returns

Implements PushTechnology.DiffusionCore.Messaging.MessageImpl.

override bool PushTechnology.DiffusionCore.Messaging.DataMessageImpl.IsDataMessage ( )
virtual
string PushTechnology.DiffusionCore.Messaging.DataMessageImpl.MessageDetails ( )

Returns the details of the message in 'L=...,T=...,E=...' format.

Returns
byte PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextByte ( )

Returns the next byte of data from the message.

The byte of data at the current position is returned and the position updated.

Returns
byte PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextByte ( ByteBuffer  buffer)

Next byte in buffer.

Parameters
buffer
Returns
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextBytes ( byte[]  destination)

Returns data from the message as bytes from the current position.

Bytes from current message position are transferred into the specified

destination array until the destination array is filled. The message position is then updated.

Parameters
destination
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextBytes ( ByteBuffer  buffer,
byte[]  destination 
)

Next bytes in buffer.

Parameters
buffer
destination
string PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextField ( ByteBuffer  buffer)

Return the next field from a byte buffer.

Parameters
buffer
Returns
string PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextField ( )

Relative get of a field of string data.

This returns a field of string data constructed from bytes read from the current data buffer position to the next field delimiter (or record delimiter) within the buffer, or the end of the message.

The 'HasRemaining' property should be called before calling this method.

After calling this method, the data buffer pointer will be moved beyond the delimiter found.

Returns
Record PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextRecord ( )

Relative get of a record of string data.

This returns a record of string data read from the current data buffer position to the next record delimiter within the buffer, or the end of the message. Fields (areas delimited by field delimiters) are unpacked from within the record area. If there are no field delimiters, then the returned record will contain only one field.

The 'HasRemaining' property should be called before calling this method.

After calling this method, the data buffer pointer will be moved beyond the record read.

Returns
Record PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextRecord ( IMRecord  metadata)

Returns a record of string data from the current message position using a metadata definition. This is similar to NextRecord() except the the structure of the supplied metadata is assumed for the record and the record returned can be accessed using metadata-specific methods.

Parameters
metadataThe metadata that defines the record. This must either be a simple IMRecord definition or an IMMessage which defines a single record. The data type of the metadata must be RECORD.
Returns
The next record, or null if there is no more data in the data buffer (i.e. HasRemaining is false). The record returned will be defined by the specified metadata and can be read using metadata-specific methods
Record PushTechnology.DiffusionCore.Messaging.DataMessageImpl.NextRecord ( ByteBuffer  buffer,
IMRecord  metadata 
)

Returns the next record in the buffer.

Parameters
buffer
metadata
Returns
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Put ( ByteBuffer  buffer)

Relative put of data from a ByteBuffer.

This method transfers the bytes remaining in the given source buffer into this message.

Parameters
buffer
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Put ( byte  data)

Relative put of a single byte of data.

Parameters
data
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Put ( byte[]  data)

Relative put of a byte array of data.

Parameters
data
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Put ( params string[]  data)

Relative put of string data. Converts supplied string(s) to bytes using the messages character set encoding and puts the bytes into the message starting from the current position. Multiple strings are concatenated.

Parameters
data
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Put ( IDataMessage  message)

Puts the entire contents of another message into this message.

All data bytes are copied from the source message into this message starting from the current position. The message position is then updated.

Parameters
messageThe message to copy data from.
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.PutFields ( string[]  fields)

Relative put of one or more string fields. If there is already data in the buffer which is not terminated by a record or field delimiter, then a field delimiter will be written followed by the specified fields separated by field delimiters.

Parameters
fields
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.PutFields ( params byte[]  fields)

Relative put of one or more byte array fields. Puts the bytes into the message starting from the current position. Multiple fields are separated by field delimiters. The message position is then updated. If there is already data in the buffer which is not terminated by a record or field delimiter, then a field delimiter will be written followed by the specified fields separated by field delimiters. If any field value is null it will be written as an empty field.

Parameters
fieldsThe list of fields.
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.PutObject ( object  obj)

Writes an object to the message using object serialization.

The object to be written must be serializable.

The object is written to the message from the current position using

Parameters
objThe object to write to the message
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.PutRecord ( params string[]  fields)

Relative put of a set of string fields as a record. The specified fields are written to the message delimited by field delimiters. If there is already data in the buffer that is not terminated by a record delimiter, then a record delimiter will first be written to the message.

Parameters
fields
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.PutRecord ( params byte[]  fields)

Relative put of a set of byte array fields as a record. The specified fields are written to the message delimited by field delimiters. If there is already data in the buffer that is not terminated by a record delimiter, then a record delimiter will first be written to the message.

Parameters
fieldsOne or more byte array fields.
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.PutRecords ( params Record[]  records)

Relative put of one or more records. The fields of each record are written to the message delimited by field delimiters and the records themselves are delimited by record delimiters, strings are converted to bytes using the character set of the message. The message pointer is then updated. If there is already data in the buffer that is not terminated by a record delimiter, then a record delimiter will first be written to the message. Record delimiters will then be written at the start of each subsequent record. Null entries are interpreted as empty records.

Parameters
recordsThe records - zero or more can be specified.
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.PutRecords ( List< Record records)

Relative put of one or more records from a collection.

Parameters
recordsThe collection of records.
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Rewind ( )

Rewinds the message pointer to the start of the data portion, leaving the message limit as before. This prepares the buffer for reading after being written.

void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.SetBodyFromMessage ( DataMessageImpl  message)

Sets the body of this message from another message. This is only to be used during construction. The encoded state is also copied so the buffer state of the input message is copied to this message leaving this message in the same encoding state as the source message.

Parameters
message
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.SetEncoding ( byte  encoding)

Sets the byte encoding for the message and encodes it.

Parameters
encoding
void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.SetFixedHeaders ( TopicAliasMap  topicAliasMap,
params string[]  headers 
)
protected

Sets headers allowing for transformation of the topic name.

Parameters
topicAliasMap
headers
override void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.SetFixedHeaders ( params string[]  headers)
protectedvirtual

Sets the fixed header fields. This is only called during the construction of a new message.

Parameters
headers

Reimplemented from PushTechnology.DiffusionCore.Messaging.MessageImpl.

Reimplemented in PushTechnology.DiffusionCore.Messaging.Topic.TopicLoadMessage.

override void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.SetHeaders ( List< string >  headers)
virtual

Sets the headers.

Parameters
headers

Implements PushTechnology.DiffusionCore.Messaging.MessageBase.

override void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.SetHeaders ( params string[]  headers)
virtual

Sets the headers.

Parameters
headers

Implements PushTechnology.DiffusionCore.Messaging.MessageBase.

override int PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Size ( )
virtual

Return the size of this message.

Returns

Reimplemented from PushTechnology.DiffusionCore.Messaging.MessageBase.

void PushTechnology.DiffusionCore.Messaging.DataMessageImpl.WriteToHttpBuffer ( ByteBuffer  buffer)

Writes the message to an HTTP output buffer in the correct format. The buffer must be correctly positioned with sufficient limit.

Parameters
buffer

Property Documentation

string PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Charset
getset

Returns the character set to be used by the message for byte/character conversions.

bool PushTechnology.DiffusionCore.Messaging.DataMessageImpl.HasRemaining
get

Indicates whether the message has any remaining data to read.

DataMessageInputStream PushTechnology.DiffusionCore.Messaging.DataMessageImpl.InputStream
get

Returns a binary reader which may be used for reading bytes from the message.

Reading will take place from the current message position.

ByteBuffer PushTechnology.DiffusionCore.Messaging.DataMessageImpl.InternalBuffer
get

Provides public access to the underlying byte buffer. Primarily for debugging purposes.

int PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Length
get

Returns the length of the data within the message.

override byte PushTechnology.DiffusionCore.Messaging.DataMessageImpl.MessageType
getset

Get/set the type of this message.

DataMessageOutputStream PushTechnology.DiffusionCore.Messaging.DataMessageImpl.OutputStream
get

Returns a binary writer which may be used for writing bytes to the message.

Writing will take place from the current message position.

IMessageReader PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Reader
get

This returns a reader which may be used to perform relative read operations on a message without affecting the pointers of the original message.

This may be used where there is a need for more than one thread to be able to read the same message as the standard relative read and put operations on a message are not threadsafe.

Note that any such reader maintains a reference to the message and thus would prevent it from being garbage collected.

int PushTechnology.DiffusionCore.Messaging.DataMessageImpl.Remaining
get

Indicates the number of unread data bytes remaining within the message.

byte PushTechnology.DiffusionCore.Messaging.DataMessageImpl.TheEncoding
get

Returns the message encoding.

The encoding value represents the byte encoding that will be applied to the message when it is sent.