IStreamMessage

A stream message is a message whose body comprises a stream of values, where each value has an associated data type. The contents of the body are written and read sequentially.

Inheritance hierarchy:

IBM.XMS.IPropertyContext
   |
   +----IBM.XMS.IMessage
           |
           +----IBM.XMS.IStreamMessage

When an application reads a value from the message stream, the value can be converted by XMS into another data type. For more information about this form of implicit conversion, see Stream messages.

Methods

Summary of methods:
Method Description
ReadBoolean Read a boolean value from the message stream.
ReadByte Read a signed 8-bit integer from the message stream.
ReadBytes Read an array of bytes from the message stream.
ReadChar Read a 2-byte character from the message stream.
ReadDouble Read an 8-byte double precision floating point number from the message stream.
ReadFloat Read a 4-byte floating point number from the message stream.
ReadInt Read a signed 32-bit integer from the message stream.
ReadLong Read a signed 64-bit integer from the message stream.
ReadObject Read a value from the message stream, and return its data type.
ReadShort Read a signed 16-bit integer from the message stream.
ReadString Read a string from the message stream.
Reset Put the body of the message into read-only mode and reposition the cursor at the beginning of the message stream.
WriteBoolean Write a boolean value to the message stream.
WriteByte Write a byte to the message stream.
WriteBytes Write an array of bytes to the message stream.
WriteChar Write a character to the message stream as 2 bytes, high-order byte first.
WriteDouble Convert a double precision floating point number to a long integer and write the long integer to the message stream as 8 bytes, high-order byte first.
WriteFloat Convert a floating point number to an integer and write the integer to the message stream as 4 bytes, high-order byte first.
WriteInt Write an integer to the message stream as 4 bytes, high-order byte first.
WriteLong Write a long integer to the message stream as 8 bytes, high-order byte first.
WriteObject Write a value, with a specified data type, to the message stream.
WriteShort Write a short integer to the message stream as 2 bytes, high-order byte first.
WriteString Write a string to the message stream.

ReadBoolean - Read Boolean Value

Interface:

Boolean ReadBoolean();

Read a boolean value from the message stream.

Parameters:
None
Returns:
The boolean value that is read.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadByte - Read Byte

Interface:

Int16   ReadSignedByte();
    Byte    ReadByte();

Read a signed 8-bit integer from the message stream.

Parameters:
None
Returns:
The byte that is read.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadBytes - Read Bytes

Interface:

Int32   ReadBytes(Byte[] array);

Read an array of bytes from the message stream.

Parameters:
array (input)
The buffer containing the array of bytes that is read and the length of the buffer in bytes.

If the number of bytes in the array is less than or equal to the length of the buffer, the whole array is read into the buffer. If the number of bytes in the array is greater than the length of the buffer, the buffer is filled with part of the array, and an internal cursor marks the position of the next byte to be read. A subsequent call to readBytes() reads bytes from the array starting from the current position of the cursor.

If you specify a null pointer on input, the call skips over the array of bytes without reading it.

Returns:
The number of bytes that are read into the buffer. If the buffer is partially filled, the value is less than the length of the buffer, indicating that there are no more bytes in the array remaining to be read. If there are no bytes remaining to be read from the array before the call, the value is XMSC_END_OF_BYTEARRAY.

If you specify a null pointer on input, the method returns no value.

Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadChar - Read Character

Interface:

Char    ReadChar();

Read a 2-byte character from the message stream.

Parameters:
None
Returns:
The character that is read.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadDouble - Read Double Precision Floating Point Number

Interface:

Double  ReadDouble();

Read an 8-byte double precision floating point number from the message stream.

Parameters:
None
Returns:
The double precision floating point number that is read.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadFloat - Read Floating Point Number

Interface:

Single  ReadFloat();

Read a 4-byte floating point number from the message stream.

Parameters:
None
Returns:
The floating point number that is read.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadInt - Read Integer

Interface:

Int32   ReadInt();

Read a signed 32-bit integer from the message stream.

Parameters:
None
Returns:
The integer that is read.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadLong - Read Long Integer

Interface:

Int64   ReadLong();

Read a signed 64-bit integer from the message stream.

Parameters:
None
Returns:
The long integer that is read.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadObject - Read Object

Interface:

Object  ReadObject();

Read a value from the message stream, and return its data type.

Parameters:
None
Returns:
The value, which is one of the following object types:
  • Boolean
  • Byte
  • Byte[]
  • Char
  • Double
  • Single
  • Int32
  • Int64
  • Int16
  • String
Exceptions:
XMSException

ReadShort - Read Short Integer

Interface:

Int16   ReadShort();

Read a signed 16-bit integer from the message stream.

Parameters:
None
Returns:
The short integer that is read.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

ReadString - Read String

Interface:

String  ReadString();

Read a string from the message stream. If required, XMS converts the characters in the string into the local code page.

Parameters:
None
Returns:
A String object encapsulating the string that is read. If data conversion is required, this is the string after conversion.
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

Reset - Reset

Interface:

void  Reset();

Put the body of the message into read-only mode and reposition the cursor at the beginning of the message stream.

Parameters:
None
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotReadableException
  • MessageEOFException

WriteBoolean - Write Boolean Value

Interface:

void  WriteBoolean(Boolean value);

Write a boolean value to the message stream.

Parameters:
value (input)
The boolean value to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteByte - Write Byte

Interface:

void  WriteByte(Byte value);
void  WriteSignedByte(Int16 value);

Write a byte to the message stream.

Parameters:
value (input)
The byte to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteBytes - Write Bytes

Interface:

void  WriteBytes(Byte[] value);

Write an array of bytes to the message stream.

Parameters:
value (input)
The array of bytes to be written.
length (input)
The number of bytes in the array.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteChar - Write Character

Interface:

void  WriteChar(Char value);

Write a character to the message stream as 2 bytes, high-order byte first.

Parameters:
value (input)
The character to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteDouble - Write Double Precision Floating Point Number

Interface:

void  WriteDouble(Double value);

Convert a double precision floating point number to a long integer and write the long integer to the message stream as 8 bytes, high-order byte first.

Parameters:
value (input)
The double precision floating point number to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteFloat - Write Floating Point Number

Interface:

void  WriteFloat(Single value);

Convert a floating point number to an integer and write the integer to the message stream as 4 bytes, high-order byte first.

Parameters:
value (input)
The floating point number to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteInt - Write Integer

Interface:

void  WriteInt(Int32 value);

Write an integer to the message stream as 4 bytes, high-order byte first.

Parameters:
value (input)
The integer to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteLong - Write Long Integer

Interface:

void  WriteLong(Int64 value);

Write a long integer to the message stream as 8 bytes, high-order byte first.

Parameters:
value (input)
The long integer to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteObject - Write Object

Interface:

void  WriteObject(Object value);

Write a value, with a specified data type, to the message stream.

Parameters:
objectType (input)
The value, which must be one of the following object types:
  • Boolean
  • Byte
  • Byte[]
  • Char
  • Double
  • Single
  • Int32
  • Int64
  • Int16
  • String
value (input)
An array of bytes containing the value to be written.
length (input)
The number of bytes in the array.
Returns:
Void
Exceptions:
  • XMSException

WriteShort - Write Short Integer

Interface:

void  WriteShort(Int16 value);

Write a short integer to the message stream as 2 bytes, high-order byte first.

Parameters:
value (input)
The short integer to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

WriteString - Write String

Interface:

void  WriteString(String value);

Write a string to the message stream.

Parameters:
value (input)
A String object encapsulating the string to be written.
Returns:
Void
Exceptions:
  • XMSException
  • MessageNotWritableException

Inherited properties and methods