WebLogic Messaging API Class Library |

# IStreamMessage Interface

An `IStreamMessage` object is used to send a stream of primitive types. It is filled and read sequentially. It inherits from the `IMessage` interface and adds a stream message body.

The primitive types can be read or written explicitly using methods for each type. They may also be read or written generically as objects. For instance, a call to `IStreamMessage.WriteInt(6)` is equivalent to `IStreamMessage.WriteObject((int)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 JMS has internally 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 body 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.

`IStreamMessage` objects support the following conversion table. The marked cases are supported, while the unmarked cases will throw a `MessageException`.

A value written as the row type can be read as the column type.

| boolean | sbyte | short | char | int | long | float | double | String | byte[]
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
boolean | x |  |  |  |  |  |  |  | x |
sbyte |  | x | x |  | x | x |  |  | x |
short |  |  | x |  | x | x |  |  | x |
char |  |  |  | x |  |  |  |  | x |
int |  |  |  |  | x | x |  |  | x |
long |  |  |  |  |  | x |  |  | x |
float |  |  |  |  |  |  | x | x | x |
double |  |  |  |  |  |  |  | x | x |
String | x | x | x |  | x | x | x | x | x |
byte[] |  |  |  |  |  |  |  |  |  | x

Attempting to read a null value as a primitive type will throw a `NullPointerException`.

For a list of all members of this type, see IStreamMessage Members.

public interface IStreamMessage : WebLogic.Messaging.IMessage

#### Requirements

Namespace: WebLogic.Messaging

Assembly: WebLogic.Messaging (in WebLogic.Messaging.dll)

#### See Also

IStreamMessage Members | WebLogic.Messaging Namespace | CreateStreamMessage() | IBytesMessage | IMapMessage | IMessage | IObjectMessage | ITextMessage