TIBCO EMS .NET API 10.3
TIBCO EMS .NET API 10.3
TIBCO.EMS.BytesMessage Class Reference

A BytesMessage object is used to send a message containing a stream of uninterpreted bytes. It inherits from the Message interface and adds a bytes message body. The receiver of the message supplies the interpretation of the bytes. More...

Inheritance diagram for TIBCO.EMS.BytesMessage:
TIBCO.EMS.Message

Public Member Functions

 BytesMessage (Session session)
 Construct an empty bytes message for a session. More...
 
override Object Clone ()
 Create a copy of the BytesMessage object. More...
 
bool ReadBoolean ()
 Reads a boolean from the bytes message stream. More...
 
sbyte ReadByte ()
 Reads a byte from the bytes message stream. More...
 
byte ReadUnsignedByte ()
 Reads a unsigned byte from the bytes message stream. More...
 
short ReadShort ()
 Reads a short from the bytes message stream. More...
 
ushort ReadUnsignedShort ()
 Reads a unsigned short from the bytes message stream. More...
 
char ReadChar ()
 Reads a char from the bytes message stream. More...
 
int ReadInt ()
 Reads a int from the bytes message stream. More...
 
long ReadLong ()
 Reads a long from the bytes message stream. More...
 
float ReadFloat ()
 Reads a float from the bytes message stream. More...
 
double ReadDouble ()
 Reads a double from the bytes message stream. More...
 
String ReadUTF ()
 Reads a UTF string from the bytes message stream. More...
 
int ReadBytes (byte[] value)
 Reads a byte array from the bytes message stream. More...
 
int ReadBytes (byte[] value, int length)
 Reads a byte array from the bytes message stream. More...
 
void WriteBoolean (bool value)
 Writes a boolean to the bytes message stream as a 1-byte value. The value true is written as the value (byte)1; the value false is written as the value (byte)0. More...
 
void WriteByte (byte value)
 Writes a byte to the bytes message stream as a 1-byte value. More...
 
void WriteShort (short value)
 Writes a short to the bytes message stream as two bytes, high byte first. More...
 
void WriteChar (char value)
 Writes a char to the bytes message stream More...
 
void WriteInt (int value)
 Writes a int to the bytes message stream More...
 
void WriteLong (long value)
 Writes a long to the bytes message stream More...
 
void WriteFloat (float value)
 Writes a float to the bytes message stream More...
 
void WriteDouble (double value)
 Writes a double to the bytes message stream More...
 
void WriteUTF (string value)
 Writes a utf string to the bytes message stream More...
 
void WriteBytes (byte[] value)
 Writes a byte array to the bytes message stream More...
 
void WriteBytes (byte[] value, int offset, int length)
 Writes a portion of the byte array to the bytes message stream More...
 
void WriteObject (Object value)
 Writes an object to the bytes message stream. More...
 
void Reset ()
 Puts the message body in read-only mode and repositions the stream of bytes to the beginning. More...
 
override void ClearBody ()
 Clears out the message body. Clearing a message's body does not clear its header values or property entries. More...
 
override string ToString ()
 returns a string representation of the map message More...
 
- Public Member Functions inherited from TIBCO.EMS.Message
virtual void ClearProperties ()
 Clears a message's properties. More...
 
virtual bool PropertyExists (string name)
 Test whether a named property has been set on a message. More...
 
bool GetBooleanProperty (string name)
 Returns the value of the boolean property with the specified name. More...
 
byte GetByteProperty (string name)
 Returns the value of the byte property with the specified name. More...
 
short GetShortProperty (string name)
 Returns the value of the short property with the specified name. More...
 
int GetIntProperty (string name)
 Returns the value of the int property with the specified name. More...
 
long GetLongProperty (string name)
 Returns the value of the long property with the specified name. More...
 
float GetFloatProperty (string name)
 Returns the value of the float property with the specified name. More...
 
double GetDoubleProperty (string name)
 Returns the value of the double property with the specified name. More...
 
string GetStringProperty (string name)
 Returns the value of the string property with the specified name. More...
 
Object GetObjectProperty (string name)
 Returns the value of the object property with the specified name. More...
 
virtual object GetProperty (string name, Type type)
 THIS IS FOR INTERNAL USE ONLY More...
 
void SetBooleanProperty (string name, bool val)
 Sets a boolean property value with the specified name into the message More...
 
void SetByteProperty (string name, byte val)
 Sets a byte property value with the specified name into the message More...
 
void SetShortProperty (string name, short val)
 Sets a short property value with the specified name into the message More...
 
void SetIntProperty (string name, int val)
 Sets a int property value with the specified name into the message More...
 
void SetLongProperty (string name, long val)
 Sets a long property value with the specified name into the message More...
 
void SetFloatProperty (string name, float val)
 Sets a float property value with the specified name into the message More...
 
void SetDoubleProperty (string name, double val)
 Sets a double property value with the specified name into the message More...
 
void SetStringProperty (string name, string val)
 Sets a string property value with the specified name into the message More...
 
void SetObjectProperty (string name, Object val)
 Sets an object property value with the specified name into the message More...
 
void SetBytesProperty (string name, byte[] val)
 FOR INTERNAL USE ONLY More...
 
virtual void Acknowledge ()
 Acknowledges all consumed messages of the session of this consumed message. More...
 
override string ToString ()
 returns a string representation of the message More...
 

Properties

long BodyLength [get]
 Gets the number of bytes of the message body when the message is in read-only mode. The value returned can be used to allocate a byte array. The value returned is the entire length of the message body, regardless of where the pointer for reading the message is currently located More...
 
- Properties inherited from TIBCO.EMS.Message
bool IsCompressed [set]
 THIS IS FOR INTERNAL USE ONLY More...
 
string MessageID [get, set]
 Gets and Sets the message ID for the message. More...
 
long Timestamp [get, set]
 Gets and Sets the timestamp for the message. More...
 
string CorrelationID [get, set]
 Gets and Sets the correlation ID for the message. More...
 
byte[] CorrelationIDAsBytes [get, set]
 Gets and Sets the correlation ID as an array of bytes for the message. More...
 
Destination Destination [get, set]
 Gets and Sets the Destination object for this message. More...
 
Destination ReplyTo [get, set]
 Gets and Sets the message's replyto value. More...
 
int DeliveryMode [get, set]
 Get and set the message's delivery mode as an integer constant as defined in the DeliveryMode class. Users are recommended to use the MessageDeliveryMode enum instead. More...
 
MessageDeliveryMode MsgDeliveryMode [get, set]
 Get and set the message's delivery mode as enum value of type MessageDeliveryMode More...
 
bool Redelivered [get, set]
 Gets and Sets the message's redelivered value. More...
 
string MsgType [get, set]
 Gets and Sets the message's type value. More...
 
long Expiration [get, set]
 Gets and Sets the message's expiration value. More...
 
int Priority [get, set]
 Gets and Sets the message's priority value. More...
 
long DeliveryTime [get]
 Gets the message's delivery time value. More...
 
IEnumerator PropertyNames [get]
 Returns an Enumeration of all the property names. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from TIBCO.EMS.Message
static string GetDeliveryModeName (MessageDeliveryMode deliveryMode)
 
static string GetDeliveryModeName (int deliveryMode)
 
static string GetTimeName (long timestamp)
 
- Public Attributes inherited from TIBCO.EMS.Message
const int DEFAULT_DELIVERY_MODE = TIBCO.EMS.DeliveryMode.PERSISTENT
 The message producer's default delivery mode is PERSISTENT. More...
 
const MessageDeliveryMode DEFAULT_MSG_DELIVERY_MODE = TIBCO.EMS.MessageDeliveryMode.Persistent
 The message producer's default delivery mode is PERSISTENT. More...
 
const int DEFAULT_PRIORITY = 4
 The message producer's default priority is 4. More...
 
const long DEFAULT_TIME_TO_LIVE = 0
 The message producer's default time to live is unlimited; the message never expires. More...
 
- Static Public Attributes inherited from TIBCO.EMS.Message
static EmptyEnum emptyEnum = new EmptyEnum()
 empty enum object for internal use More...
 

Detailed Description

A BytesMessage object is used to send a message containing a stream of uninterpreted bytes. It inherits from the Message interface and adds a bytes message body. The receiver of the message supplies the interpretation of the bytes.

This message type is for client encoding of existing message formats. If possible, one of the other self-defining message types should be used instead.

The primitive types can be written explicitly using methods for each type. They may also be written generically as objects. For instance, a call to BytesMessage.writeInt(6) is equivalent to BytesMessage.writeObject((object)6). Both forms are provided, because the explicit form is convenient for static programming, and the object form is needed when types are not known at compile time.

When the message is first created, and when clearBody is called, the body of the message is in write-only mode. After the first call to reset has been made, the message body is in read-only mode. After a message has been sent, the client that sent it can retain and modify it without affecting the message that has been sent. The same message object can be sent multiple times. When a message has been received, the provider has called reset so that the message body is in read-only mode for the client.

If clearBody is called on a message in read-only mode, the message body is cleared and the message is in write-only mode.

If a client attempts to read a message in write-only mode, a MessageNotReadableException is thrown.

If a client attempts to write a message in read-only mode, a MessageNotWriteableException is thrown.

Constructor & Destructor Documentation

TIBCO.EMS.BytesMessage.BytesMessage ( Session  session)
inline

Construct an empty bytes message for a session.

Parameters
sessionThe session of the message.

Member Function Documentation

override void TIBCO.EMS.BytesMessage.ClearBody ( )
inlinevirtual

Clears out the message body. Clearing a message's body does not clear its header values or property entries.

If this message body was read-only, calling this method leaves the message body in the same state as an empty body in a newly created message.

Reimplemented from TIBCO.EMS.Message.

override Object TIBCO.EMS.BytesMessage.Clone ( )
inlinevirtual

Create a copy of the BytesMessage object.

Reimplemented from TIBCO.EMS.Message.

bool TIBCO.EMS.BytesMessage.ReadBoolean ( )
inline

Reads a boolean from the bytes message stream.

Reads one byte from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the boolean value read
sbyte TIBCO.EMS.BytesMessage.ReadByte ( )
inline

Reads a byte from the bytes message stream.

Reads one byte from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the byte value read
int TIBCO.EMS.BytesMessage.ReadBytes ( byte[]  value)
inline

Reads a byte array from the bytes message stream.

This method reads bytes from the stream into the byte array and advances the read position.

Returns
The actual number of bytes read. When the call cannot read even one byte, it returns -1.
int TIBCO.EMS.BytesMessage.ReadBytes ( byte[]  value,
int  length 
)
inline

Reads a byte array from the bytes message stream.

This method reads bytes from the stream into the byte array and advances the read position. This method attempts to read length bytes; otherwise it attempts to read value.length bytes.

Returns
The actual number of bytes read. When the method cannot read even one byte, it returns -1.
char TIBCO.EMS.BytesMessage.ReadChar ( )
inline

Reads a char from the bytes message stream.

Reads two bytes from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the char value read
double TIBCO.EMS.BytesMessage.ReadDouble ( )
inline

Reads a double from the bytes message stream.

Reads eight bytes from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the double value read
float TIBCO.EMS.BytesMessage.ReadFloat ( )
inline

Reads a float from the bytes message stream.

Reads four bytes from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the float value read
int TIBCO.EMS.BytesMessage.ReadInt ( )
inline

Reads a int from the bytes message stream.

Reads four bytes from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the int value read
long TIBCO.EMS.BytesMessage.ReadLong ( )
inline

Reads a long from the bytes message stream.

Reads eight bytes from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the long value read
short TIBCO.EMS.BytesMessage.ReadShort ( )
inline

Reads a short from the bytes message stream.

Reads two bytes from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the short value read
byte TIBCO.EMS.BytesMessage.ReadUnsignedByte ( )
inline

Reads a unsigned byte from the bytes message stream.

Reads one byte from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the unsigned byte value read
ushort TIBCO.EMS.BytesMessage.ReadUnsignedShort ( )
inline

Reads a unsigned short from the bytes message stream.

Reads two bytes from the byte stream of a BytesMessage and advances the read position so that the next read call gets the next datum.

Returns
the unsigned short value read
String TIBCO.EMS.BytesMessage.ReadUTF ( )
inline

Reads a UTF string from the bytes message stream.

Reads a UTF-8 string. Since the length of the string cannot be determined in advance, the method stores the actual length of the string.

Returns
the utf string value read
void TIBCO.EMS.BytesMessage.Reset ( )
inline

Puts the message body in read-only mode and repositions the stream of bytes to the beginning.

Reset prepares a message body for reading, as if the message were newly received. This is in contrast to Message.ClearBody, which clears a message body in preparation for writing, as if it were newly created.

override string TIBCO.EMS.BytesMessage.ToString ( )
inline

returns a string representation of the map message

Returns
a string representation of the map message
void TIBCO.EMS.BytesMessage.WriteBoolean ( bool  value)
inline

Writes a boolean to the bytes message stream as a 1-byte value. The value true is written as the value (byte)1; the value false is written as the value (byte)0.

Writes one byte of data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe boolean value to be written
void TIBCO.EMS.BytesMessage.WriteByte ( byte  value)
inline

Writes a byte to the bytes message stream as a 1-byte value.

Writes one byte of data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe byte value to be written
void TIBCO.EMS.BytesMessage.WriteBytes ( byte[]  value)
inline

Writes a byte array to the bytes message stream

Each call writes bytes from the byte array into the stream, and advances the write position.

Parameters
valuethe byte array value to be written
void TIBCO.EMS.BytesMessage.WriteBytes ( byte[]  value,
int  offset,
int  length 
)
inline

Writes a portion of the byte array to the bytes message stream

Parameters
valueWrite bytes from this byte array to the message.
offsetBegin with the byte at this offset within the byte array.
lengthWrite this number of bytes from the byte array.

The offset and length arguments must conform to these restrictions:

  • offset must be in the range [0, value.length-1]
  • length must be in the range [0, value.length]
  • offset+length must be in the range [0, value.length]

That is, these two arguments must specify a span of bytes within the value argument. Otherwise the call throws a System.IndexOutOfRangeException (and does not write any bytes).

void TIBCO.EMS.BytesMessage.WriteChar ( char  value)
inline

Writes a char to the bytes message stream

Writes two bytes of data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe char value to be written
void TIBCO.EMS.BytesMessage.WriteDouble ( double  value)
inline

Writes a double to the bytes message stream

Writes eight bytes of data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe double value to be written
void TIBCO.EMS.BytesMessage.WriteFloat ( float  value)
inline

Writes a float to the bytes message stream

Writes four bytes of data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe float value to be written
void TIBCO.EMS.BytesMessage.WriteInt ( int  value)
inline

Writes a int to the bytes message stream

Writes four bytes of data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe int value to be written
void TIBCO.EMS.BytesMessage.WriteLong ( long  value)
inline

Writes a long to the bytes message stream

Writes eight bytes of data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe long value to be written
void TIBCO.EMS.BytesMessage.WriteObject ( Object  value)
inline

Writes an object to the bytes message stream.

Converts an object to a primitive value (if possible), and writes that value to the byte stream.

This method works only for the objectified primitive object types (Integer, Double, Long ...), String objects, and byte arrays

Parameters
valuethe object to be written
void TIBCO.EMS.BytesMessage.WriteShort ( short  value)
inline

Writes a short to the bytes message stream as two bytes, high byte first.

Writes two bytes of data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe short to be written
void TIBCO.EMS.BytesMessage.WriteUTF ( string  value)
inline

Writes a utf string to the bytes message stream

Writes variable-length encoded UTF-8 data to the stream and advances the write position so that the next write call appends to the new end of the stream.

Parameters
valuethe utf string value to be written

Property Documentation

long TIBCO.EMS.BytesMessage.BodyLength
get

Gets the number of bytes of the message body when the message is in read-only mode. The value returned can be used to allocate a byte array. The value returned is the entire length of the message body, regardless of where the pointer for reading the message is currently located

Returns
number of bytes in the message

Copyright © 1997-2024 Cloud Software Group, Inc. All Rights Reserved.