StreamMessage

 



public interface StreamMessage
extends Message

WebSphere MQ class: JMSStreamMessage



java.lang.Object
   |
   +----com.ibm.jms.JMSMessage
           |
           +----com.ibm.jms.JMSStreamMessage

Use a StreamMessage to send a stream of Java primitives.

See also: BytesMessage, MapMessage, Message, ObjectMessage and TextMessage

 

Methods

readBoolean
public boolean readBoolean() throws JMSException

Read a boolean from the stream message.

Returns:
The boolean value read.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readByte
public byte readByte() throws JMSException

Read a byte value from the stream message.

Returns:
The next byte from the stream message as an 8-bit byte.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readBytes
public int readBytes(byte[] value)
              throws JMSExceptioneam message.

Read a byte array field from the stream message into the specified byte[] object (the read buffer). If the buffer size is less than, or equal to, the size of the data in the message field, an application must make further calls to this method to retrieve the remainder of the data. Once the first readBytes call on a byte[] field value has been done, the full value of the field must be read before it is valid to read the next field. An attempt to read the next field before that has been done throws a MessageFormatException.

Parameters:
value: the buffer into which the data is read.

Returns:
The total number of bytes read into the buffer, or -1 if there is no more data because the end of the byte field has been reached.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readChar
public char readChar() throws JMSException

Read a Unicode character value from the stream message.

Returns:
A Unicode character from the stream message.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readDouble
public double readDouble() throws JMSException

Read a double from the stream message.

Returns:
A double value from the stream message.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readFloat
public float readFloat() throws JMSException

Read a float from the stream message.

Returns:
A float value from the stream message.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readInt
public int readInt() throws JMSException

Read a 32-bit integer from the stream message.

Returns:
A 32-bit integer value from the stream message, interpreted as an int.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readLong
public long readLong() throws JMSException

Read a 64-bit integer from the stream message.

Returns:
A 64-bit integer value from the stream message, interpreted as a long.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readObject
public java.lang.Object readObject() throws JMSException

Read a Java object from the stream message.

Returns:
A Java object from the stream message in object format (for example, if it was set as an int, an integer is returned).

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • NotReadableException if the message is in write-only mode.

readShort
public short readShort() throws JMSException

Read a 16-bit number from the stream message.

Returns:
A 16-bit number from the stream message.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode.

readString
public java.lang.String readString() throws JMSException

Read in a string from the stream message.

Returns:
A Unicode string from the stream message.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageEOFException if an end of message stream is received.

  • MessageFormatException if this type conversion is not valid.

  • MessageNotReadableException if the message is in write-only mode

reset
public void reset() throws JMSException

Put the message in read-only mode, and reposition the stream to the beginning.

Throws:

  • JMSException if JMS fails to reset the message because of an internal JMS error.

  • MessageFormatException if the message has an non valid format.

writeBoolean
public void writeBoolean(boolean value) throws JMSException

Write a boolean to the stream message.

Parameters:
value: the boolean value to be written.

Throws:

  • JMSException if JMS fails to read the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeByte
public void writeByte(byte value) throws JMSException

Write a byte to the stream message.

Parameters:
value: the byte value to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeBytes
public void writeBytes(byte[] value) throws JMSException

Write a byte array to the stream message.

Parameters:
value: the byte array to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeBytes
public void writeBytes(byte[] value,
                       int offset,
                       int length) throws JMSException

Write a portion of a byte array to the stream message.

Parameters:

  • value: the byte array value to be written.

  • offset: the initial offset within the byte array.

  • length: the number of bytes to use.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeChar
public void writeChar(char value) throws JMSException

Write a character to the stream message.

Parameters:
value: the character value to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeDouble
public void writeDouble(double value) throws JMSException

Write a double to the stream message.

Parameters:
value: the double value to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeFloat
public void writeFloat(float value) throws JMSException

Write a float to the stream message.

Parameters:
value: the float value to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeInt
public void writeInt(int value) throws JMSException

Write an integer to the stream message.

Parameters:
value: the integer to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeLong
public void writeLong(long value) throws JMSException

Write a long to the stream message.

Parameters:
value: the long to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeObject
public void writeObject(java.lang.Object value)
                                         throws JMSException

Write a Java object to the stream message. This method works only for object primitive types (for example, Integer, Double, Long), strings, and byte arrays.

Parameters:
value: the Java object to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

  • MessageFormatException if the object is not valid.

writeShort
public void writeShort(short value) throws JMSException

Write a short to the stream message.

Parameters:
value: the short to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

writeString
public void writeString(java.lang.String value)
                                          throws JMSException

Write a string to the stream message.

Parameters:
value: the string value to be written.

Throws:

  • JMSException if JMS fails to write the message because of an internal JMS error.

  • MessageNotWriteableException if the message is in read-only mode.

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.