IBytesMessage

A bytes message is a message whose body comprises a stream of bytes.

Parent topic: .NET interfaces


.NET properties

    Summary of .NET properties:

    .NET property Description
    BodyLength Get the length of the body of the message in bytes when the body of the message is read-only.


BodyLength - Get Body Length

    Interface:
    Int64 BodyLength    
        {
          get;
        }
    

Get the length of the body of the message in bytes when the body of the message is read-only.

The value returned is the length of the whole body regardless of where the cursor for reading the message is currently positioned.

    Exceptions:

    • XMSException
    • MessageNotReadableException


Methods

    Summary of methods:

    Method Description
    ReadBoolean Read a boolean value from the bytes message stream.
    ReadSignedByte Read the next byte from the bytes message stream as a signed 8-bit integer.
    ReadBytes Read an array of bytes from the bytes message stream starting from the current position of the cursor.
    ReadChar Read the next 2 bytes from the bytes message stream as a character.
    ReadDouble Read the next 8 bytes from the bytes message stream as a double precision floating point number.
    ReadFloat Read the next 4 bytes from the bytes message stream as a floating point number.
    ReadInt Read the next 4 bytes from the bytes message stream as a signed 32-bit integer.
    ReadLong Read the next 8 bytes from the bytes message stream as a signed 64-bit integer.
    ReadShort Read the next 2 bytes from the bytes message stream as a signed 16-bit integer.
    ReadByte Read the next byte from the bytes message stream as an unsigned 8-bit integer.
    ReadUnsignedShort Read the next 2 bytes from the bytes message stream as an unsigned 16-bit integer.
    ReadUTF Read a string, encoded in UTF-8, from the bytes message stream.
    Reset Put the body of the message into read-only mode and reposition the cursor at the beginning of the bytes message stream.
    WriteBoolean Write a boolean value to the bytes message stream.
    WriteByte Write a byte to the bytes message stream.
    WriteBytes Write an array of bytes to the bytes message stream.
    WriteBytes Write a partial array of bytes to the bytes message stream, as defined by the specified length.
    WriteChar Write a character to the bytes 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 bytes message stream as 8 bytes, high-order byte first.
    WriteFloat Convert a floating point number to an integer and write the integer to the bytes message stream as 4 bytes, high-order byte first.
    WriteInt Write an integer to the bytes message stream as 4 bytes, high-order byte first.
    WriteLong Write a long integer to the bytes message stream as 8 bytes, high-order byte first.
    WriteObject Write the specified object into the byte message stream.
    WriteShort Write a short integer to the bytes message stream as 2 bytes, high-order byte first.
    WriteUTF Write a string, encoded in UTF-8, to the bytes message stream.


ReadBoolean - Read Boolean Value

    Interface:
    Boolean ReadBoolean();
    

Read a boolean value from the bytes message stream.

    Parameters:
    None

    Returns:
    The boolean value that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadSignedByte - Read Byte

    Interface:
    Int16   ReadSignedByte();
    

Read the next byte from the bytes message stream as a signed 8-bit integer.

    Parameters:
    None

    Returns:
    The byte that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadBytes - Read Bytes

    Interface:
    Int32   ReadBytes(Byte[] array);                
    Int32   ReadBytes(Byte[] array, Int32 length);  
    

Read an array of bytes from the bytes message stream starting from the current position of the cursor.

    Parameters:

      array (output)
      The buffer to contain the array of bytes that is read. If the number of bytes remaining to be read from the stream before the call is greater than or equal to the length of the buffer, the buffer is filled. Otherwise, the buffer is partially filled with all the remaining bytes.

      If you specify a null pointer on input, the method skips over the bytes without reading them. If the number of bytes remaining to be read from the stream before the call is greater than or equal to the length of the buffer, the number of bytes skipped is equal to the length of the buffer. Otherwise, all the remaining bytes are skipped. The cursor remains at the next position to read in the byte message stream.

      length (input)
      The length of the buffer in bytes

    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 remaining to be read. If there are no bytes remaining to be read from the stream before the call, the value is XMSC_END_OF_STREAM.

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

    Exceptions:

    • XMSException
    • MessageNotReadableException


ReadChar - Read Character

    Interface:
    Char    ReadChar();
    

Read the next 2 bytes from the bytes message stream as a character.

    Parameters:
    None

    Returns:
    The character that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadDouble - Read Double Precision Floating Point Number

    Interface:
    Double  ReadDouble();
    

Read the next 8 bytes from the bytes message stream as a double precision floating point number.

    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 the next 4 bytes from the bytes message stream as a floating point number.

    Parameters:
    None

    Returns:
    The floating point number that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadInt - Read Integer

    Interface:
    Int32   ReadInt();
    

Read the next 4 bytes from the bytes message stream as a signed 32-bit integer.

    Parameters:
    None

    Returns:
    The integer that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadLong - Read Long Integer

    Interface:
    Int64   ReadLong();
    

Read the next 8 bytes from the bytes message stream as a signed 64-bit integer.

    Parameters:
    None

    Returns:
    The long integer that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadShort - Read Short Integer

    Interface:
    Int16   ReadShort();
    

Read the next 2 bytes from the bytes message stream as a signed 16-bit integer.

    Parameters:
    None

    Returns:
    The short integer that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadByte - Read Unsigned Byte

    Interface:
    Byte    ReadByte();
    

Read the next byte from the bytes message stream as an unsigned 8-bit integer.

    Parameters:
    None

    Returns:
    The byte that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadUnsignedShort - Read Unsigned Short Integer

    Interface:
    Int32   ReadUnsignedShort();
    

Read the next 2 bytes from the bytes message stream as an unsigned 16-bit integer.

    Parameters:
    None

    Returns:
    The unsigned short integer that is read.

    Exceptions:

    • XMSException
    • MessageNotReadableException
    • MessageEOFException


ReadUTF - Read UTF String

    Interface:
    String  ReadUTF();
    

Read a string, encoded in UTF-8, from the bytes message stream. Note: Before calling ReadUTF(), ensure that the cursor of the buffer is pointing to beginning of the byte message stream.

    Parameters:
    None

    Returns:
    A String object encapsulating the string that is read.

    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 bytes message stream.

    Parameters:
    None

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageNotReadableException


WriteBoolean - Write Boolean Value

    Interface:
    void  WriteBoolean(Boolean value);
    

Write a boolean value to the bytes 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 bytes 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 bytes message stream.

    Parameters:

      value (input)
      The array of bytes to be written.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageNotWritableException


WriteBytes - Write Partial Bytes Array

    Interface:
    void  WriteBytes(Byte[] value, int offset, int length);
    

Write a partial array of bytes to the bytes message stream, as defined by the specified length.

    Parameters:

      value (input)
      The array of bytes to be written.

      offset (input)
      The starting point for the array of bytes to be written.

      length (input)
      The number of bytes to write.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageNotWritableException


WriteChar - Write Character

    Interface:
    void  WriteChar(Char value);
    

Write a character to the bytes 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 bytes 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 bytes 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 bytes 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 bytes 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 the specified object into the byte message stream.

    Parameters:

      value (input)
      The object to be written, which must be a reference to a primitive type.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageNotWritableException


WriteShort - Write Short Integer

    Interface:
    void  WriteShort(Int16 value);
    

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

    Parameters:

      value (input)
      The short integer to be written.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageNotWritableException


WriteUTF - Write UTF String

    Interface:
    void  WriteUTF(String value);
    

Write a string, encoded in UTF-8, to the bytes message stream.

    Parameters:

      value (input)
      A String object encapsulating the string to be written.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageNotWritableException


Inherited properties and methods

The following properties are inherited from the IMessage interface:

The following methods are inherited from the IMessage interface:

The following methods are inherited from the IPropertyContext interface: