Packagecom.kaazing.gateway.jms.client
Interfacepublic interface 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. If possible, one of the other self-defining message types should be used instead.

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.

The primitive types can be written explicitly using methods for each type. They may also be written generically as objects. For instance, a call to BytesMessage.writeInt(6) is equivalent to BytesMessage.writeObject(new Integer(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 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.



Public Properties
 PropertyDefined by
  bodyLength : int
[read-only] Gets the number of bytes of the message body when the message is in read-only mode.
BytesMessage
 InheritedcorrelationId : String
Gets the correlation ID for the message.
Message
 InheriteddeliveryMode : int
Gets the DeliveryMode value specified for this message.
Message
 Inheriteddestination : Destination
Gets the Destination object for this message.
Message
 Inheritedexpiration : Number
Gets the message's expiration value.
Message
 InheritedmessageId : String
Gets the message ID.
Message
 Inheritedpriority : int
Gets the message priority level.
Message
 Inheritedredelivered : Boolean
Gets an indication of whether this message is being redelivered.
Message
 InheritedreplyTo : Destination
Gets the Destination object to which a reply to this message should be sent.
Message
 Inheritedtimestamp : Number
Gets the message timestamp.
Message
 Inheritedtype : String
Gets the message type identifier supplied by the client when the message was sent.
Message
Public Methods
 MethodDefined by
 Inherited
acknowledge():void
Acknowledges all consumed messages of the session of this consumed message.
Message
 Inherited
clearBody():void
Clears out the message body.
Message
 Inherited
Clears a message's properties.
Message
 Inherited
getBooleanProperty(name:String):Boolean
Returns the value of the boolean property with the specified name.
Message
 Inherited
getByteProperty(name:String):int
Returns the value of the byte property with the specified name.
Message
 Inherited
getDoubleProperty(name:String):Number
Returns the value of the double property with the specified name.
Message
 Inherited
getFloatProperty(name:String):Number
Returns the value of the float property with the specified name.
Message
 Inherited
getIntProperty(name:String):int
Returns the value of the int property with the specified name.
Message
 Inherited
getLongProperty(name:String):Number
Returns the value of the long property with the specified name.
Message
 Inherited
getObjectProperty(name:String):Object
Returns the value of the object property with the specified name.
Message
 Inherited
Returns an Enumeration of all the property names.
Message
 Inherited
getShortProperty(name:String):int
Returns the value of the short property with the specified name.
Message
 Inherited
getStringProperty(name:String):String
Returns the value of the String property with the specified name.
Message
 Inherited
propertyExists(name:String):Boolean
Indicates whether a property value exists.
Message
  
readBoolean():Boolean
Reads a boolean from the bytes message stream.
BytesMessage
  
readByte():int
Reads a signed 8-bit value from the bytes message stream.
BytesMessage
  
readBytes(value:ByteArray, length:int = -1):int
Reads a portion of the bytes message stream.
BytesMessage
  
readChar():String
Reads a Unicode character value from the bytes message stream.
BytesMessage
  
readDouble():Number
Reads a double from the bytes message stream.
BytesMessage
  
readFloat():Number
Reads a float from the bytes message stream.
BytesMessage
  
readInt():int
Reads a signed 32-bit integer from the bytes message stream.
BytesMessage
  
readLong():Number
Reads a signed 64-bit integer from the bytes message stream.
BytesMessage
  
readShort():int
Reads a signed 16-bit number from the bytes message stream.
BytesMessage
  
Reads an unsigned 8-bit number from the bytes message stream.
BytesMessage
  
Reads an unsigned 16-bit number from the bytes message stream.
BytesMessage
  
readUTF():String
Reads a string that has been encoded using a modified UTF-8 format from the bytes message stream.
BytesMessage
  
reset():void
Puts the message body in read-only mode and repositions the stream of bytes to the beginning.
BytesMessage
 Inherited
setBooleanProperty(name:String, value:Boolean):void
Sets a boolean property value with the specified name into the message.
Message
 Inherited
setByteProperty(name:String, value:int):void
Sets a byte property value with the specified name into the message.
Message
 Inherited
setDoubleProperty(name:String, value:Number):void
Sets a double property value with the specified name into the message.
Message
 Inherited
setFloatProperty(name:String, value:Number):void
Sets a float property value with the specified name into the message.
Message
 Inherited
setIntProperty(name:String, value:int):void
Sets an int property value with the specified name into the message.
Message
 Inherited
setLongProperty(name:String, value:Number):void
Sets a long property value with the specified name into the message.
Message
 Inherited
setObjectProperty(name:String, value:Object):void
Sets a object property value with the specified name into the message.
Message
 Inherited
setShortProperty(name:String, value:int):void
Sets a short property value with the specified name into the message.
Message
 Inherited
setStringProperty(name:String, value:String):void
Sets a String property value with the specified name into the message.
Message
  
writeBoolean(value:Boolean):void
Writes a boolean to the bytes message stream as a 1-byte value.
BytesMessage
  
writeByte(value:int):void
Writes a byte to the bytes message stream as a 1-byte value.
BytesMessage
  
writeBytes(value:ByteArray, offset:int = 0, length:int = -1):void
Writes a portion of a byte array to the bytes message stream.
BytesMessage
  
writeChar(value:String):void
Writes a char to the bytes message stream as a 2-byte value, high byte first.
BytesMessage
  
writeDouble(value:Number):void
Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the bytes message stream as an 8-byte quantity, high byte first.
BytesMessage
  
writeFloat(value:Number):void
Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the bytes message stream as a 4-byte quantity, high byte first.
BytesMessage
  
writeInt(value:int):void
Writes an int to the bytes message stream as four bytes, high byte first.
BytesMessage
  
writeLong(value:Number):void
Writes a long to the bytes message stream as eight bytes, high byte first.
BytesMessage
  
writeObject(value:Object):void
Writes an object to the bytes message stream.
BytesMessage
  
writeShort(value:int):void
Writes a short to the bytes message stream as two bytes, high byte first.
BytesMessage
  
writeUTF(value:String):void
Writes a string to the bytes message stream using UTF-8 encoding in a machine-independent manner.
BytesMessage
Property detail
bodyLengthproperty
bodyLength:int  [read-only]

Gets the number of bytes of the message body when the message is in read-only mode. The value returned can be used to allocate a byte array. The value returned is the entire length of the message body, regardless of where the pointer for reading the message is currently located.

Implementation
    public function get bodyLength():int
Method detail
readBoolean()method
public function readBoolean():Boolean

Reads a boolean from the bytes message stream.

Returns
Boolean — the boolean value read
readByte()method 
public function readByte():int

Reads a signed 8-bit value from the bytes message stream.

Returns
int — the next byte from the bytes message stream as a signed 8-bit byte
readBytes()method 
public function readBytes(value:ByteArray, length:int = -1):int

Reads a portion of the bytes message stream.

If the length of array value is less than the number of bytes remaining to be read from the stream, the array should be filled. A subsequent call reads the next increment, and so on.

If the number of bytes remaining in the stream is less than the length of array value, the bytes should be read into the array. The return value of the total number of bytes read will be less than the length of the array, indicating that there are no more bytes left to be read from the stream. The next read of the stream returns -1.

If length is negative, or length is greater than the length of the array value, then an IndexOutOfBoundsException is thrown. No bytes will be read from the stream for this exception case. Parameters

value:ByteArray — the buffer into which the data is read
 
length:int (default = -1) — the number of bytes to read; must be less than or equal to value.length

Returns
int — the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached
readChar()method 
public function readChar():String

Reads a Unicode character value from the bytes message stream.

Returns
String — the next two bytes from the bytes message stream as a Unicode character
readDouble()method 
public function readDouble():Number

Reads a double from the bytes message stream.

Returns
Number — the next eight bytes from the bytes message stream, interpreted as a double
readFloat()method 
public function readFloat():Number

Reads a float from the bytes message stream.

Returns
Number — the next four bytes from the bytes message stream, interpreted as a float
readInt()method 
public function readInt():int

Reads a signed 32-bit integer from the bytes message stream.

Returns
int — the next four bytes from the bytes message stream, interpreted as an int
readLong()method 
public function readLong():Number

Reads a signed 64-bit integer from the bytes message stream.

Returns
Number — the next eight bytes from the bytes message stream, interpreted as a long
readShort()method 
public function readShort():int

Reads a signed 16-bit number from the bytes message stream.

Returns
int — the next two bytes from the bytes message stream, interpreted as a signed 16-bit number
readUnsignedByte()method 
public function readUnsignedByte():int

Reads an unsigned 8-bit number from the bytes message stream.

Returns
int — the next byte from the bytes message stream, interpreted as an unsigned 8-bit number
readUnsignedShort()method 
public function readUnsignedShort():int

Reads an unsigned 16-bit number from the bytes message stream.

Returns
int — the next two bytes from the bytes message stream, interpreted as an unsigned 16-bit integer
readUTF()method 
public function readUTF():String

Reads a string that has been encoded using a modified UTF-8 format from the bytes message stream.

For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.

Returns
String — a Unicode string from the bytes message stream
reset()method 
public function reset():void

Puts the message body in read-only mode and repositions the stream of bytes to the beginning.

writeBoolean()method 
public function writeBoolean(value:Boolean):void

Writes a boolean to the bytes message stream as a 1-byte value. The value true is written as the value (byte)1; the value false is written as the value (byte)0.

Parameters
value:Boolean — the boolean value to be written
writeByte()method 
public function writeByte(value:int):void

Writes a byte to the bytes message stream as a 1-byte value.

Parameters
value:int — the byte value to be written
writeBytes()method 
public function writeBytes(value:ByteArray, offset:int = 0, length:int = -1):void

Writes a portion of a byte array to the bytes message stream.

Parameters
value:ByteArray — the byte array value to be written
 
offset:int (default = 0) — the initial offset within the byte array
 
length:int (default = -1) — the number of bytes to use
writeChar()method 
public function writeChar(value:String):void

Writes a char to the bytes message stream as a 2-byte value, high byte first.

Parameters
value:String — the char value to be written
writeDouble()method 
public function writeDouble(value:Number):void

Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the bytes message stream as an 8-byte quantity, high byte first.

Parameters
value:Number — the double value to be written
writeFloat()method 
public function writeFloat(value:Number):void

Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the bytes message stream as a 4-byte quantity, high byte first.

Parameters
value:Number — the float value to be written
writeInt()method 
public function writeInt(value:int):void

Writes an int to the bytes message stream as four bytes, high byte first.

Parameters
value:int — the int to be written
writeLong()method 
public function writeLong(value:Number):void

Writes a long to the bytes message stream as eight bytes, high byte first.

Parameters
value:Number — the long to be written
writeObject()method 
public function writeObject(value:Object):void

Writes an object to the bytes message stream.

This method works only for the objectified primitive object types (int, Number (written as a double), Boolean ...), String objects, and byte arrays.

Parameters
value:Object — the object to be written; it must not be null
writeShort()method 
public function writeShort(value:int):void

Writes a short to the bytes message stream as two bytes, high byte first.

Parameters
value:int — the short to be written
writeUTF()method 
public function writeUTF(value:String):void

Writes a string to the bytes message stream using UTF-8 encoding in a machine-independent manner.

For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.

Parameters
value:String — the String value to be written