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 Summary
Fields inherited from class com.sun.ts.tests.jms.common.MessageTestImpl
bufferIsDirty, dummy, readModeFields inherited from interface jakarta.jms.Message
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE -
Constructor Summary
Constructors -
Method Summary
Modifier 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.MessageTestImpl
acknowledge, 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.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.jms.Message
acknowledge, 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
-
BytesMessageTestImpl
public BytesMessageTestImpl()Class Constructor.
-
-
Method Details
-
clearBody
public void clearBody() throws jakarta.jms.JMSExceptionMethod Declaration.- Specified by:
clearBodyin interfacejakarta.jms.Message- Overrides:
clearBodyin classMessageTestImpl- Throws:
jakarta.jms.JMSException
-
readBoolean
public boolean readBoolean() throws jakarta.jms.JMSExceptionRead abooleanfrom the BytesMessage.- Specified by:
readBooleanin interfacejakarta.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
-
readByte
public byte readByte() throws jakarta.jms.JMSExceptionRead a signed 8-bit value from the BytesMessage.- Specified by:
readBytein interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readUnsignedByte
public int readUnsignedByte() throws jakarta.jms.JMSExceptionRead an unsigned 8-bit number from the BytesMessage.- Specified by:
readUnsignedBytein interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readShort
public short readShort() throws jakarta.jms.JMSExceptionRead a signed 16-bit number from the BytesMessage.- Specified by:
readShortin interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readUnsignedShort
public int readUnsignedShort() throws jakarta.jms.JMSExceptionRead an unsigned 16-bit number from the BytesMessage.- Specified by:
readUnsignedShortin interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readChar
public char readChar() throws jakarta.jms.JMSExceptionRead a Unicode character value from the BytesMessage.- Specified by:
readCharin interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readInt
public int readInt() throws jakarta.jms.JMSExceptionRead a signed 32-bit integer from the BytesMessage.- Specified by:
readIntin interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readLong
public long readLong() throws jakarta.jms.JMSExceptionRead a signed 64-bit integer from the BytesMessage.- Specified by:
readLongin interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readFloat
public float readFloat() throws jakarta.jms.JMSExceptionRead afloatfrom the BytesMessage.- Specified by:
readFloatin interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readDouble
public double readDouble() throws jakarta.jms.JMSExceptionRead adoublefrom the BytesMessage.- Specified by:
readDoublein interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readUTF
Read 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 interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readBytes
public int readBytes(byte[] value) throws jakarta.jms.JMSException Read a byte array from the BytesMessage.- Specified by:
readBytesin interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
readBytes
public int readBytes(byte[] value, int length) throws jakarta.jms.JMSException Read a portion of the bytes message.- Specified by:
readBytesin interfacejakarta.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 streamjakarta.jms.JMSException- if JMS fails to read message due to some internal JMS error.
-
writeBoolean
public 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 interfacejakarta.jms.BytesMessage- Parameters:
value- thebooleanvalue 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.
-
writeByte
public void writeByte(byte value) throws jakarta.jms.JMSException Write out abyteto the BytesMessage as a 1-byte value.- Specified by:
writeBytein interfacejakarta.jms.BytesMessage- Parameters:
value- thebytevalue 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.
-
writeShort
public void writeShort(short value) throws jakarta.jms.JMSException Write ashortto the BytesMessage as two bytes, high byte first.- Specified by:
writeShortin interfacejakarta.jms.BytesMessage- Parameters:
value- theshortto 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.
-
writeChar
public void writeChar(char value) throws jakarta.jms.JMSException Write acharto the BytesMessage as a 2-byte value, high byte first.- Specified by:
writeCharin interfacejakarta.jms.BytesMessage- Parameters:
value- thecharvalue 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.
-
writeInt
public void writeInt(int value) throws jakarta.jms.JMSException Write anintto the BytesMessage as four bytes, high byte first.- Specified by:
writeIntin interfacejakarta.jms.BytesMessage- Parameters:
value- theintto 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.
-
writeLong
public void writeLong(long value) throws jakarta.jms.JMSException Write alongto the BytesMessage as eight bytes, high byte first.- Specified by:
writeLongin interfacejakarta.jms.BytesMessage- Parameters:
value- thelongto 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.
-
writeFloat
public 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 interfacejakarta.jms.BytesMessage- Parameters:
value- thefloatvalue 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.
-
writeDouble
public 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 interfacejakarta.jms.BytesMessage- Parameters:
value- thedoublevalue 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.
-
writeUTF
Write 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 interfacejakarta.jms.BytesMessage- Parameters:
value- theStringvalue 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.
-
writeBytes
public void writeBytes(byte[] value) throws jakarta.jms.JMSException Write a byte array to the BytesMessage.- Specified by:
writeBytesin interfacejakarta.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.
-
writeBytes
public 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 interfacejakarta.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.
-
writeObject
Write 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 interfacejakarta.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.
-
reset
public void reset() throws jakarta.jms.JMSExceptionPut the message in read-only mode, and reposition the stream of bytes to the beginning.- Specified by:
resetin interfacejakarta.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
-
getBodyLength
public long getBodyLength()- Specified by:
getBodyLengthin interfacejakarta.jms.BytesMessage
-
setBodyLength
public void setBodyLength(long l)
-