Package com.sun.ts.tests.jms.common
Class BytesMessageTestImpl
java.lang.Object
com.sun.ts.tests.jms.common.MessageTestImpl
com.sun.ts.tests.jms.common.BytesMessageTestImpl
- All Implemented Interfaces:
- jakarta.jms.BytesMessage,- jakarta.jms.Message
Class Declaration.
- 
Field SummaryFields inherited from class com.sun.ts.tests.jms.common.MessageTestImplbufferIsDirty, dummy, readModeFields inherited from interface jakarta.jms.MessageDEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidMethod Declaration.longbooleanRead abooleanfrom the BytesMessage.bytereadByte()Read a signed 8-bit value from the BytesMessage.intreadBytes(byte[] value) Read a byte array from the BytesMessage.intreadBytes(byte[] value, int length) Read a portion of the bytes message.charreadChar()Read a Unicode character value from the BytesMessage.doubleRead adoublefrom the BytesMessage.floatRead afloatfrom the BytesMessage.intreadInt()Read a signed 32-bit integer from the BytesMessage.longreadLong()Read a signed 64-bit integer from the BytesMessage.shortRead a signed 16-bit number from the BytesMessage.intRead an unsigned 8-bit number from the BytesMessage.intRead an unsigned 16-bit number from the BytesMessage.readUTF()Read in a string that has been encoded using a modified UTF-8 format from the BytesMessage.voidreset()Put the message in read-only mode, and reposition the stream of bytes to the beginning.voidsetBodyLength(long l) voidwriteBoolean(boolean writeBoolean) Write abooleanto the BytesMessage as a 1-byte value.voidwriteByte(byte value) Write out abyteto the BytesMessage as a 1-byte value.voidwriteBytes(byte[] value) Write a byte array to the BytesMessage.voidwriteBytes(byte[] value, int offset, int length) Write a portion of a byte array to the BytesMessage.voidwriteChar(char value) Write acharto the BytesMessage as a 2-byte value, high byte first.voidwriteDouble(double value) Convert the double argument to alongusing thedoubleToLongBitsmethod in classDouble, and then writes thatlongvalue to the stream message as an 8-byte quantity, high byte first.voidwriteFloat(float value) Convert the float argument to anintusing thefloatToIntBitsmethod in classFloat, and then writes thatintvalue to the stream message as a 4-byte quantity, high byte first.voidwriteInt(int value) Write anintto the BytesMessage as four bytes, high byte first.voidwriteLong(long value) Write alongto the BytesMessage as eight bytes, high byte first.voidwriteObject(Object value) Write a Java object to the BytesMessage.voidwriteShort(short value) Write ashortto the BytesMessage as two bytes, high byte first.voidWrite a string to the BytesMessage using UTF-8 encoding in a machine-independent manner.Methods inherited from class com.sun.ts.tests.jms.common.MessageTestImplacknowledge, checkReadAccess, clearProperties, getBody, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, isBodyAssignableTo, propertyExists, setBooleanProperty, setBufferIsDirty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringPropertyMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.jms.Messageacknowledge, clearProperties, getBody, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, isBodyAssignableTo, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
- 
Constructor Details- 
BytesMessageTestImplpublic BytesMessageTestImpl()Class Constructor.
 
- 
- 
Method Details- 
clearBodypublic void clearBody() throws jakarta.jms.JMSExceptionMethod Declaration.- Specified by:
- clearBodyin interface- jakarta.jms.Message
- Overrides:
- clearBodyin class- MessageTestImpl
- Throws:
- jakarta.jms.JMSException
 
- 
readBooleanpublic boolean readBoolean() throws jakarta.jms.JMSExceptionRead abooleanfrom the BytesMessage.- Specified by:
- readBooleanin interface- jakarta.jms.BytesMessage
- Returns:
- the booleanvalue read.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
- jakarta.jms.MessageEOFException- if end of message stream
 
- 
readBytepublic byte readByte() throws jakarta.jms.JMSExceptionRead a signed 8-bit value from the BytesMessage.- Specified by:
- readBytein interface- jakarta.jms.BytesMessage
- Returns:
- the next byte from the BytesMessage as a signed 8-bit byte.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readUnsignedBytepublic int readUnsignedByte() throws jakarta.jms.JMSExceptionRead an unsigned 8-bit number from the BytesMessage.- Specified by:
- readUnsignedBytein interface- jakarta.jms.BytesMessage
- Returns:
- the next byte from the BytesMessage, interpreted as an unsigned 8-bit number.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readShortpublic short readShort() throws jakarta.jms.JMSExceptionRead a signed 16-bit number from the BytesMessage.- Specified by:
- readShortin interface- jakarta.jms.BytesMessage
- Returns:
- the next two bytes from the BytesMessage, interpreted as a signed 16-bit number.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readUnsignedShortpublic int readUnsignedShort() throws jakarta.jms.JMSExceptionRead an unsigned 16-bit number from the BytesMessage.- Specified by:
- readUnsignedShortin interface- jakarta.jms.BytesMessage
- Returns:
- the next two bytes from the BytesMessage, interpreted as an unsigned 16-bit integer.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readCharpublic char readChar() throws jakarta.jms.JMSExceptionRead a Unicode character value from the BytesMessage.- Specified by:
- readCharin interface- jakarta.jms.BytesMessage
- Returns:
- the next two bytes from the BytesMessage as a Unicode character.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readIntpublic int readInt() throws jakarta.jms.JMSExceptionRead a signed 32-bit integer from the BytesMessage.- Specified by:
- readIntin interface- jakarta.jms.BytesMessage
- Returns:
- the next four bytes from the BytesMessage, interpreted as an int.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readLongpublic long readLong() throws jakarta.jms.JMSExceptionRead a signed 64-bit integer from the BytesMessage.- Specified by:
- readLongin interface- jakarta.jms.BytesMessage
- Returns:
- the next eight bytes from the BytesMessage, interpreted as a long.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readFloatpublic float readFloat() throws jakarta.jms.JMSExceptionRead afloatfrom the BytesMessage.- Specified by:
- readFloatin interface- jakarta.jms.BytesMessage
- Returns:
- the next four bytes from the BytesMessage, interpreted as a float.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readDoublepublic double readDouble() throws jakarta.jms.JMSExceptionRead adoublefrom the BytesMessage.- Specified by:
- readDoublein interface- jakarta.jms.BytesMessage
- Returns:
- the next eight bytes from the BytesMessage, interpreted as a double.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readUTFRead in a string that has been encoded using a modified UTF-8 format from the BytesMessage. For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UFT)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.- Specified by:
- readUTFin interface- jakarta.jms.BytesMessage
- Returns:
- a Unicode string from the BytesMessage.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readBytespublic int readBytes(byte[] value) throws jakarta.jms.JMSException Read a byte array from the BytesMessage.- Specified by:
- readBytesin interface- jakarta.jms.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 the stream has been reached.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
readBytespublic int readBytes(byte[] value, int length) throws jakarta.jms.JMSException Read a portion of the bytes message.- Specified by:
- readBytesin interface- jakarta.jms.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 the stream has been reached.
- Throws:
- jakarta.jms.MessageNotReadableException- if message in write-only mode.
- jakarta.jms.MessageEOFException- if end of message stream
- jakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
 
- 
writeBooleanpublic void writeBoolean(boolean writeBoolean) throws jakarta.jms.JMSException Write abooleanto the BytesMessage as a 1-byte value. The valuetrueis written out as the value(byte)1; the valuefalseis written out as the value(byte)0.- Specified by:
- writeBooleanin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- booleanvalue to be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeBytepublic void writeByte(byte value) throws jakarta.jms.JMSException Write out abyteto the BytesMessage as a 1-byte value.- Specified by:
- writeBytein interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- bytevalue to be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeShortpublic void writeShort(short value) throws jakarta.jms.JMSException Write ashortto the BytesMessage as two bytes, high byte first.- Specified by:
- writeShortin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- shortto be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeCharpublic void writeChar(char value) throws jakarta.jms.JMSException Write acharto the BytesMessage as a 2-byte value, high byte first.- Specified by:
- writeCharin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- charvalue to be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeIntpublic void writeInt(int value) throws jakarta.jms.JMSException Write anintto the BytesMessage as four bytes, high byte first.- Specified by:
- writeIntin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- intto be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeLongpublic void writeLong(long value) throws jakarta.jms.JMSException Write alongto the BytesMessage as eight bytes, high byte first.- Specified by:
- writeLongin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- longto be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeFloatpublic void writeFloat(float value) throws jakarta.jms.JMSException Convert the float argument to anintusing thefloatToIntBitsmethod in classFloat, and then writes thatintvalue to the stream message as a 4-byte quantity, high byte first.- Specified by:
- writeFloatin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- floatvalue to be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeDoublepublic void writeDouble(double value) throws jakarta.jms.JMSException Convert the double argument to alongusing thedoubleToLongBitsmethod in classDouble, and then writes thatlongvalue to the stream message as an 8-byte quantity, high byte first.- Specified by:
- writeDoublein interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- doublevalue to be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeUTFWrite a string to the BytesMessage 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_UFT)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.- Specified by:
- writeUTFin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the- Stringvalue to be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeBytespublic void writeBytes(byte[] value) throws jakarta.jms.JMSException Write a byte array to the BytesMessage.- Specified by:
- writeBytesin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the byte array to be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeBytespublic void writeBytes(byte[] value, int offset, int length) throws jakarta.jms.JMSException Write a portion of a byte array to the BytesMessage.- Specified by:
- writeBytesin interface- jakarta.jms.BytesMessage
- 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:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
writeObjectWrite a Java object to the BytesMessage. Note that this method only works for the objectified primitive object types (Integer, Double, Long ...), String's and byte arrays.- Specified by:
- writeObjectin interface- jakarta.jms.BytesMessage
- Parameters:
- value- the Java object to be written.
- Throws:
- jakarta.jms.MessageNotWriteableException- if message in read-only mode.
- jakarta.jms.MessageFormatException- if object is invalid type.
- jakarta.jms.JMSException- if JMS fails to write message due to some internal JMS error.
 
- 
resetpublic void reset() throws jakarta.jms.JMSExceptionPut the message in read-only mode, and reposition the stream of bytes to the beginning.- Specified by:
- resetin interface- jakarta.jms.BytesMessage
- Throws:
- jakarta.jms.JMSException- if JMS fails to reset the message due to some internal JMS error.
- jakarta.jms.MessageFormatException- if message has an invalid format
 
- 
getBodyLengthpublic long getBodyLength()- Specified by:
- getBodyLengthin interface- jakarta.jms.BytesMessage
 
- 
setBodyLengthpublic void setBodyLength(long l) 
 
-