Class BytesMessage

Extends Message.

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.

Although the JMS API allows the use of message properties with byte messages, they are typically not used, since the inclusion of properties may affect the format.

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 Summary
BytesMessage()
            A BytesMessage object is used to send a message containing a stream of uninterpreted bytes.
 
Method Summary
 Number getBodyLength()
           Gets the number of bytes of the message body when the message is in read-only mode.
 boolean readBoolean()
           Reads a boolean from the bytes message stream.
 Number readByte()
           Reads a signed 8-bit value from the bytes message stream.
 Number readBytes(value, len)
           Reads a portion of the bytes message stream.
 String readChar()
           Reads a Unicode character value from the bytes message stream.
 Number readDouble()
           Reads a double from the bytes message stream.
 Number readFloat()
           Reads a float from the bytes message stream.
 Number readInt()
           Reads a signed 32-bit integer from the bytes message stream.
 Number readLong()
           Reads a signed 64-bit integer from the bytes message stream.
 Number readShort()
           Reads a signed 16-bit number from the bytes message stream.
 Number readUnsignedByte()
           Reads an unsigned 8-bit number from the bytes message stream.
 Number readUnsignedShort()
           Reads an unsigned 16-bit number from the bytes message stream.
 String readUTF()
           Reads a string that has been encoded using a modified UTF-8 format from the bytes message stream.
 void reset()
           Puts the message body in read-only mode and repositions the stream of bytes to the beginning.
 void writeBoolean(value)
           Writes a boolean to the bytes message stream as a 1-byte value.
 void writeByte(value)
           Writes a byte to the bytes message stream as a 1-byte value.
 void writeBytes(value, offset, len)
           Writes a portion of a byte array to the bytes message stream.
 void writeChar(value)
           Writes a char to the bytes message stream as a 2-byte value, high byte first.
 void writeDouble(value)
           Writes the double value to the bytes message stream as an 8-byte quantity.
 void writeFloat(value)
           Writes a float value to the bytes message stream as a 4-byte quantity.
 void writeInt(value)
           Writes an int to the bytes message stream as four bytes, high byte first.
 void writeLong(value)
           Writes a long to the bytes message stream as eight bytes, high byte first.
 void writeShort(value)
           Writes a short to the bytes message stream as two bytes, high byte first.
 void writeUTF(value)
           Writes a string to the bytes message stream using UTF-8 encoding in a machine-independent manner.
 
Methods inherited from class Message
getJMSMessageID()
setJMSMessageID(id)
getJMSTimestamp()
setJMSTimestamp(timestamp)
setJMSCorrelationID(correlationID)
getJMSCorrelationID()
getJMSReplyTo()
setJMSReplyTo(replyTo)
getJMSDestination()
setJMSDestination(destination)
getJMSDeliveryMode()
setJMSDeliveryMode(deliveryMode)
getJMSRedelivered()
setJMSRedelivered(redelivered)
getJMSType()
setJMSType(type)
getJMSExpiration()
setJMSExpiration(expiration)
getJMSPriority()
setJMSPriority(priority)
clearProperties()
propertyExists(name)
getBooleanProperty(name)
getByteProperty(name)
getShortProperty(name)
getIntProperty(name)
getLongProperty(name)
getFloatProperty(name)
getDoubleProperty(name)
getStringProperty(name)
getObjectProperty(name)
setBooleanProperty(name, value)
setByteProperty(name, value)
setShortProperty(name, value)
setIntProperty(name, value)
setLongProperty(name, value)
setFloatProperty(name, value)
setDoubleProperty(name, value)
setStringProperty(name, value)
setObjectProperty(name, value)
getPropertyNames()
acknowledge()
clearBody()


Constructor Detail

BytesMessage

BytesMessage()

Method Detail

getBodyLength

Number getBodyLength()

readBoolean

boolean readBoolean()

readByte

Number readByte()

readBytes

Number readBytes(value, len)

readChar

String readChar()

readDouble

Number readDouble()

readFloat

Number readFloat()

readInt

Number readInt()

readLong

Number readLong()

readShort

Number readShort()

readUnsignedByte

Number readUnsignedByte()

readUnsignedShort

Number readUnsignedShort()

readUTF

String readUTF()

reset

void reset()

writeBoolean

void writeBoolean(value)

writeByte

void writeByte(value)

writeBytes

void writeBytes(value, offset, len)

writeChar

void writeChar(value)

writeDouble

void writeDouble(value)

writeFloat

void writeFloat(value)

writeInt

void writeInt(value)

writeLong

void writeLong(value)

writeShort

void writeShort(value)

writeUTF

void writeUTF(value)