Oracle® Streams Advanced Queuing Java API Reference
10g Release 2 (10.2)

B14291-01


oracle.jms
Class AQjmsBytesMessage

java.lang.Object
  extended byoracle.jms.AQjmsMessage
      extended byoracle.jms.AQjmsBytesMessage

All Implemented Interfaces:
BytesMessage, Message

public class AQjmsBytesMessage
extends AQjmsMessage
implements BytesMessage

This is an Oracle class which implements javax.jms.BytesMessage.


Field Summary

Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE

Method Summary
void clearBody()
Clears out the message body.
void clearProperties()
Clears a message's properties.
long getBodyLength()
Gets the number of bytes of the message body when the message is in read-only mode.
boolean readBoolean()
Reads the next byte from this bytes message and returns it as a boolean.
byte readByte()
Reads the next byte from this bytes message and returns it as a byte.
int readBytes(byte[] value)
Reads bytes from this bytes message and places them into a byte[] buffer.
int readBytes(byte[] value, int length)
Reads bytes from this bytes message and places them into the specified portion of a byte[] buffer.
char readChar()
Reads the next two bytes from this bytes message and returns them as a char.
double readDouble()
Reads the next eight bytes from this bytes message and returns them as a double.
float readFloat()
Reads the next four bytes from this bytes message and returns them as a float.
int readInt()
Reads the next four bytes from this bytes message and returns them as an int.
long readLong()
Reads the next eight bytes from this bytes message and returns them as a long.
short readShort()
Reads the next two bytes from this bytes message and returns them as a short.
int readUnsignedByte()
Reads the next byte from this bytes message and returns it as an int.
int readUnsignedShort()
Reads the next two bytes from this bytes message and returns them as an int.
java.lang.String readUTF()
Reads a string that has been encoded using a modified UTF-8 format from this bytes message.
void reset()
Puts the message body into read-only mode, and repositions the byte stream to the beginning.
void writeBoolean(boolean value)
Writes a boolean to this bytes message as one byte.
void writeByte(byte value)
Writes a byte to this bytes message as a single-byte integer.
void writeBytes(byte[] value)
Writes the contents of a byte[] to this bytes message.
void writeBytes(byte[] value, int offset, int length)
Writes a portion of a byte[] to this bytes message.
void writeChar(char value)
Writes a char to this bytes message as a two-byte value, high byte first.
void writeDouble(double value)
Writes a double to this bytes message as an IEEE 754 double-precision number (byte with sign-bit first).
void writeFloat(float value)
Writes a float to this bytes message as an IEEE 754 single-precision number (byte with sign-bit first).
void writeInt(int value)
Writes an int to this bytes message as a big-endian four-byte integer.
void writeLong(long value)
Writes a long to this bytes message as a big-endian eight-byte integer.
void writeObject(java.lang.Object value)
Writes a Java object to this bytes message.
void writeShort(short value)
Writes a short to this bytes message as a big-endian two-byte integer.
void writeUTF(java.lang.String value)
Writes a String to this bytes message using UTF-8 encoding in a machine-independent manner.

Methods inherited from class oracle.jms.AQjmsMessage
acknowledge, getAttempts, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSMessageIDAsBytes, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getSenderID, getShortProperty, getStringProperty, getUserPropertyNames, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setSenderID, setShortProperty, setStringProperty

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface javax.jms.Message
acknowledge, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty

Method Detail

clearBody

public void clearBody()
               throws JMSException
Clears out the message body. All other parts of the message are left untouched.
Specified by:
clearBody in interface Message
Overrides:
clearBody in class AQjmsMessage
Throws:
JMSException - if the message body is not cleared due to some error.

clearProperties

public void clearProperties()
                     throws JMSException
Clears a message's properties.
Specified by:
clearProperties in interface Message
Overrides:
clearProperties in class AQjmsMessage
Throws:
JMSException - if the message properties are not cleared due to some error.

readBoolean

public boolean readBoolean()
                    throws JMSException
Reads the next byte from this bytes message and returns it as a boolean.
Specified by:
readBoolean in interface BytesMessage
Returns:
the byte read, interpreted as a boolean
Throws:
JMSException - if a boolean is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readByte

public byte readByte()
              throws JMSException
Reads the next byte from this bytes message and returns it as a byte.
Specified by:
readByte in interface BytesMessage
Returns:
the byte read, interpreted as an 8-bit signed integer
Throws:
JMSException - if a byte is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readUnsignedByte

public int readUnsignedByte()
                     throws JMSException
Reads the next byte from this bytes message and returns it as an int.
Specified by:
readUnsignedByte in interface BytesMessage
Returns:
the byte read, interpreted as an 8-bit unsigned integer
Throws:
JMSException - if an int is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readShort

public short readShort()
                throws JMSException
Reads the next two bytes from this bytes message and returns them as a short.
Specified by:
readShort in interface BytesMessage
Returns:
the bytes read, interpreted as a big-endian 16-bit signed integer
Throws:
JMSException - if a short is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readUnsignedShort

public int readUnsignedShort()
                      throws JMSException
Reads the next two bytes from this bytes message and returns them as an int.
Specified by:
readUnsignedShort in interface BytesMessage
Returns:
the bytes read, interpreted as a big-endian 16-bit unsigned integer
Throws:
JMSException - if an int is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readChar

public char readChar()
              throws JMSException
Reads the next two bytes from this bytes message and returns them as a char.
Specified by:
readChar in interface BytesMessage
Returns:
the bytes read, interpreted as a Unicode character
Throws:
JMSException - if a char is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readInt

public int readInt()
            throws JMSException
Reads the next four bytes from this bytes message and returns them as an int.
Specified by:
readInt in interface BytesMessage
Returns:
the bytes read, interpreted as a big-endian 32-bit signed integer
Throws:
JMSException - if an int is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readLong

public long readLong()
              throws JMSException
Reads the next eight bytes from this bytes message and returns them as a long.
Specified by:
readLong in interface BytesMessage
Returns:
the bytes read, interpreted as a big-endian 64-bit signed integer
Throws:
JMSException - if a long is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readFloat

public float readFloat()
                throws JMSException
Reads the next four bytes from this bytes message and returns them as a float.
Specified by:
readFloat in interface BytesMessage
Returns:
the bytes read, interpreted as an IEEE 754 single-precision number (byte with sign-bit first)
Throws:
JMSException - if a float is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readDouble

public double readDouble()
                  throws JMSException
Reads the next eight bytes from this bytes message and returns them as a double.
Specified by:
readDouble in interface BytesMessage
Returns:
the bytes read, interpreted as an IEEE 754 double-precision number (byte with sign-bit first)
Throws:
JMSException - if a double is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readUTF

public java.lang.String readUTF()
                         throws JMSException
Reads a string that has been encoded using a modified UTF-8 format from this bytes message.
Specified by:
readUTF in interface BytesMessage
Returns:
the bytes read, interpreted as a Unicode string
Throws:
JMSException - if a String is not retrieved due to some error.
MessageEOFException - if the end of the bytes stream has been reached.
MessageNotReadableException - if the message is in write-only mode.

readBytes

public int readBytes(byte[] value)
              throws JMSException
Reads bytes from this bytes message and places them into a byte[] buffer.
Specified by:
readBytes in interface BytesMessage
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 this bytes message has been reached
Throws:
JMSException - if the bytes are not read due to some error.
MessageNotReadableException - if the message is in write-only mode.

readBytes

public int readBytes(byte[] value,
                     int length)
              throws JMSException
Reads bytes from this bytes message and places them into the specified portion of a byte[] buffer.
Specified by:
readBytes in interface BytesMessage
Parameters:
value - the buffer into which the data is read
length - the number of bytes to read
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of this bytes message has been reached
Throws:
JMSException - if the bytes are not read due to some error.
MessageNotReadableException - if the message is in write-only mode.

writeBoolean

public void writeBoolean(boolean value)
                  throws JMSException
Writes a boolean to this bytes message as one byte. For true, (byte)1 is written. For false, (byte)0 is written.
Specified by:
writeBoolean in interface BytesMessage
Parameters:
value - the boolean value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeByte

public void writeByte(byte value)
               throws JMSException
Writes a byte to this bytes message as a single-byte integer.
Specified by:
writeByte in interface BytesMessage
Parameters:
value - the byte value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeShort

public void writeShort(short value)
                throws JMSException
Writes a short to this bytes message as a big-endian two-byte integer.
Specified by:
writeShort in interface BytesMessage
Parameters:
value - the short value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeChar

public void writeChar(char value)
               throws JMSException
Writes a char to this bytes message as a two-byte value, high byte first.
Specified by:
writeChar in interface BytesMessage
Parameters:
value - the char value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeInt

public void writeInt(int value)
              throws JMSException
Writes an int to this bytes message as a big-endian four-byte integer.
Specified by:
writeInt in interface BytesMessage
Parameters:
value - the int value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeLong

public void writeLong(long value)
               throws JMSException
Writes a long to this bytes message as a big-endian eight-byte integer.
Specified by:
writeLong in interface BytesMessage
Parameters:
value - the long value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeFloat

public void writeFloat(float value)
                throws JMSException
Writes a float to this bytes message as an IEEE 754 single-precision number (byte with sign-bit first).
Specified by:
writeFloat in interface BytesMessage
Parameters:
value - the float value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeDouble

public void writeDouble(double value)
                 throws JMSException
Writes a double to this bytes message as an IEEE 754 double-precision number (byte with sign-bit first).
Specified by:
writeDouble in interface BytesMessage
Parameters:
value - the double value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeUTF

public void writeUTF(java.lang.String value)
              throws JMSException
Writes a String to this bytes message using UTF-8 encoding in a machine-independent manner.
Specified by:
writeUTF in interface BytesMessage
Parameters:
value - the String value to be written
Throws:
JMSException - if value is not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeBytes

public void writeBytes(byte[] value)
                throws JMSException
Writes the contents of a byte[] to this bytes message.
Specified by:
writeBytes in interface BytesMessage
Parameters:
value - the source array
Throws:
JMSException - if the bytes are not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeBytes

public void writeBytes(byte[] value,
                       int offset,
                       int length)
                throws JMSException
Writes a portion of a byte[] to this bytes message.
Specified by:
writeBytes in interface BytesMessage
Parameters:
value - the source array
offset - the initial offset within the source array
length - the number of bytes to use from the source array
Throws:
JMSException - if the bytes are not written due to some error.
MessageNotWriteableException - if the message is in read-only mode.

writeObject

public void writeObject(java.lang.Object value)
                 throws JMSException
Writes a Java object to this bytes message.

Note that this method only works for the objectified primitive object types (Integer, Double, Long ...), Strings and byte arrays. The output format is the same as for the the equivalent primitive writetype method.

Specified by:
writeObject in interface BytesMessage
Parameters:
value - the Java object to be written
Throws:
JMSException - if value is not written due to some error.
MessageFormatException - if the object is of an invalid type.
MessageNotWriteableException - if the message is in read-only mode.
java.lang.NullPointerException - if the parameter value is null.

reset

public void reset()
           throws JMSException
Puts the message body into read-only mode, and repositions the byte stream to the beginning.
Specified by:
reset in interface BytesMessage
Throws:
JMSException - if the message is not reset due to some error.
MessageFormatException - if the message has an invalid format.

getBodyLength

public long getBodyLength()
                   throws JMSException
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.
Specified by:
getBodyLength in interface BytesMessage
Returns:
number of bytes in the message
Throws:
JMSException - if the JMS provider fails to read the message due to some internal error.
MessageNotReadableException - if the message is in write-only mode.
Since:
1.1

Oracle® Streams Advanced Queuing Java API Reference
10g Release 2 (10.2)

B14291-01


Copyright © 2003, 2005, Oracle. All rights reserved.