Package com.swiftmq.jms
Class BytesMessageImpl
- java.lang.Object
-
- com.swiftmq.jms.MessageImpl
-
- com.swiftmq.jms.BytesMessageImpl
-
- All Implemented Interfaces:
jakarta.jms.BytesMessage,jakarta.jms.Message,java.io.Serializable
public class BytesMessageImpl extends MessageImpl implements jakarta.jms.BytesMessage
Implementation of a BytesMessage.- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.swiftmq.jms.MessageImpl
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY, PROP_CLIENT_ID, PROP_DELIVERY_COUNT, PROP_DOUBT_DUPLICATE, PROP_UNROUTABLE_REASON, PROP_USER_ID
-
-
Constructor Summary
Constructors Constructor Description BytesMessageImpl()Creates a new BytesMessageImpl.BytesMessageImpl(byte[] array, int cnt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]_getBody()long_getBodyLength()voidclearBody()Clear out the message body.longgetBodyLength()protected intgetType()protected voidreadBody(java.io.DataInput in)booleanreadBoolean()bytereadByte()Read a signed 8-bit value from the stream message.intreadBytes(byte[] value)Read a byte array from the stream message.intreadBytes(byte[] value, int length)Read a portion of the bytes message.charreadChar()Read a Unicode character value from the stream message.doublereadDouble()Read adoublefrom the stream message.floatreadFloat()Read afloatfrom the stream message.intreadInt()Read a signed 32-bit integer from the stream message.longreadLong()Read a signed 64-bit integer from the stream message.shortreadShort()Read a signed 16-bit number from the stream message.intreadUnsignedByte()Read an unsigned 8-bit number from the stream message.intreadUnsignedShort()Read an unsigned 16-bit number from the stream message.java.lang.StringreadUTF()Read in a string that has been encoded using a modified UTF-8 format from the stream message.voidreset()Put the message in read-only mode, and reposition the stream of bytes to the beginning.java.lang.StringtoString()protected voidwriteBody(java.io.DataOutput out)voidwriteBoolean(boolean value)Write abooleanto the stream message as a 1-byte value.voidwriteByte(byte value)Write out abyteto the stream message as a 1-byte value.voidwriteBytes(byte[] value)Write a byte array to the stream message.voidwriteBytes(byte[] value, int offset, int length)Write a portion of a byte array to the stream message.voidwriteChar(char value)Write acharto the stream message 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 stream message as four bytes, high byte first.voidwriteLong(long value)Write alongto the stream message as eight bytes, high byte first.voidwriteObject(java.lang.Object value)Write a Java object to the stream message.voidwriteShort(short value)Write ashortto the stream message as two bytes, high byte first.voidwriteUTF(java.lang.String value)Write a string to the stream message using UTF-8 encoding in a machine-independent manner.-
Methods inherited from class com.swiftmq.jms.MessageImpl
acknowledge, clearProperties, clearSwiftMQAllProps, clearSwiftMQProps, createInstance, getBody, getBooleanProperty, getByteProperty, getDestQueue, getDestRouter, getDoubleProperty, getDuplicateId, getField, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getMessageIndex, getMessageLength, getObjectProperty, getPersistentKey, getPropertyNames, getShortProperty, getSourceRouter, getStreamPKey, getStringProperty, isBodyAssignableTo, isCancelled, propertyExists, readContent, readContent, removeProperty, setBooleanProperty, setByteProperty, setDestQueue, setDestRouter, setDoubleProperty, setDuplicateId, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setMessageConsumerImpl, setMessageIndex, setObjectProperty, setPersistentKey, setReadOnly, setSessionImpl, setShortProperty, setSourceRouter, setStreamPKey, setStringProperty, setUseThreadContextCL, unfoldBody, unfoldBuffers, writeContent, writeContent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods 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
-
-
-
-
Method Detail
-
getType
protected int getType()
- Overrides:
getTypein classMessageImpl
-
writeBody
protected void writeBody(java.io.DataOutput out) throws java.io.IOException- Overrides:
writeBodyin classMessageImpl- Throws:
java.io.IOException
-
readBody
protected void readBody(java.io.DataInput in) throws java.io.IOException- Overrides:
readBodyin classMessageImpl- Throws:
java.io.IOException
-
_getBodyLength
public long _getBodyLength()
-
_getBody
public byte[] _getBody()
-
getBodyLength
public long getBodyLength() throws jakarta.jms.JMSException- Specified by:
getBodyLengthin interfacejakarta.jms.BytesMessage- Throws:
jakarta.jms.JMSException
-
readBoolean
public boolean readBoolean() throws jakarta.jms.JMSException- Specified by:
readBooleanin interfacejakarta.jms.BytesMessage- Throws:
jakarta.jms.JMSException
-
readByte
public byte readByte() throws jakarta.jms.JMSExceptionRead a signed 8-bit value from the stream message.- Specified by:
readBytein interfacejakarta.jms.BytesMessage- Returns:
- the next byte from the stream message 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 stream message.- Specified by:
readUnsignedBytein interfacejakarta.jms.BytesMessage- Returns:
- the next byte from the stream message, 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 stream message.- Specified by:
readShortin interfacejakarta.jms.BytesMessage- Returns:
- the next two bytes from the stream message, 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 stream message.- Specified by:
readUnsignedShortin interfacejakarta.jms.BytesMessage- Returns:
- the next two bytes from the stream message, 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 stream message.- Specified by:
readCharin interfacejakarta.jms.BytesMessage- Returns:
- the next two bytes from the stream message 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 stream message.- Specified by:
readIntin interfacejakarta.jms.BytesMessage- Returns:
- the next four bytes from the stream message, 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 stream message.- Specified by:
readLongin interfacejakarta.jms.BytesMessage- Returns:
- the next eight bytes from the stream message, 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 stream message.- Specified by:
readFloatin interfacejakarta.jms.BytesMessage- Returns:
- the next four bytes from the stream message, 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 stream message.- Specified by:
readDoublein interfacejakarta.jms.BytesMessage- Returns:
- the next eight bytes from the stream message, 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
public java.lang.String readUTF() throws jakarta.jms.JMSExceptionRead in a string that has been encoded using a modified UTF-8 format from the stream message.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 stream message.
- 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.JMSExceptionRead a byte array from the stream message.- 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.JMSExceptionRead 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 value) throws jakarta.jms.JMSExceptionWrite abooleanto the stream message 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.JMSExceptionWrite out abyteto the stream message 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.JMSExceptionWrite ashortto the stream message 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.JMSExceptionWrite acharto the stream message 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.JMSExceptionWrite anintto the stream message 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.JMSExceptionWrite alongto the stream message 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.JMSExceptionConvert 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.JMSExceptionConvert 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
public void writeUTF(java.lang.String value) throws jakarta.jms.JMSExceptionWrite a string to the stream message 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.JMSExceptionWrite a byte array to the stream message.- 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.JMSExceptionWrite a portion of a byte array to the stream message.- 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
public void writeObject(java.lang.Object value) throws jakarta.jms.JMSExceptionWrite a Java object to the stream message.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- Overrides:
resetin classMessageImpl- 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
-
clearBody
public void clearBody() throws jakarta.jms.JMSExceptionClear out the message body. All other parts of the message are left untouched.- Specified by:
clearBodyin interfacejakarta.jms.Message- Overrides:
clearBodyin classMessageImpl- Throws:
jakarta.jms.JMSException- if JMS fails to due to some internal JMS error.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classMessageImpl
-
-