public class SQSBytesMessage extends SQSMessage
ActiveMQStreamMessage, which is also
licensed under Apache2.0. Its methods are based largely on those found in
java.io.DataInputStream and
java.io.DataOutputStream.org.apache.activemq.command.ActiveMQStreamMessageSQSMessage.JMSMessagePropertyValue, SQSMessage.TypeConversionSupportBYTE_MESSAGE_TYPE, JMS_SQS_MESSAGE_TYPE, JMS_SQS_REPLY_TO_QUEUE_NAME, JMS_SQS_REPLY_TO_QUEUE_URL, OBJECT_MESSAGE_TYPE, TEXT_MESSAGE_TYPE| Constructor and Description |
|---|
SQSBytesMessage()
Create new empty BytesMessage to send.
|
SQSBytesMessage(Acknowledger acknowledger,
java.lang.String queueUrl,
Message sqsMessage)
Convert received SQSMessage into BytesMessage.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearBody()
When the message is first created, and when clearBody is called, the body
of the message is in write-only mode.
|
byte[] |
getBodyAsBytes()
Reads the body of message, which can be either the body returned from the
the receives message as bytes or the bytes put in bytesOut if it is a
sent message.
|
long |
getBodyLength()
Gets the number of bytes of the message body when the message is in
read-only mode.
|
boolean |
readBoolean()
Reads a
boolean from the bytes message stream. |
byte |
readByte()
Reads a signed 8-bit value from the bytes message stream.
|
int |
readBytes(byte[] value)
Reads a byte array from the bytes message stream.
|
int |
readBytes(byte[] value,
int length)
Reads a portion of the bytes message stream.
|
char |
readChar()
Reads a Unicode character value from the bytes message stream.
|
double |
readDouble()
Reads a
double from the bytes message stream. |
float |
readFloat()
Reads a
float from the bytes message stream. |
int |
readInt()
Reads a 32-bit integer from the bytes message stream.
|
long |
readLong()
Reads a 64-bit integer from the bytes message stream.
|
short |
readShort()
Reads a signed 16-bit number from the bytes message stream.
|
int |
readUnsignedByte()
Reads an unsigned 8-bit value from the bytes message stream.
|
int |
readUnsignedShort()
Reads an unsigned 16-bit number from the bytes message stream.
|
java.lang.String |
readUTF()
Reads a string that has been encoded using a UTF-8 format from
the bytes message stream
|
void |
reset()
Puts the message body in read-only mode and repositions the stream of
bytes to the beginning.
|
void |
writeBoolean(boolean value)
Writes a
boolean to the bytes message stream |
void |
writeByte(byte value)
Writes a
byte to the bytes message stream |
void |
writeBytes(byte[] value)
Writes a byte array to the bytes
message stream
|
void |
writeBytes(byte[] value,
int offset,
int length)
Writes a portion of a byte array to the bytes message stream.
|
void |
writeChar(char value)
Writes a
char to the bytes message stream |
void |
writeDouble(double value)
Writes a
double to the bytes message stream |
void |
writeFloat(float value)
Writes a
float to the bytes message stream |
void |
writeInt(int value)
Writes a
int to the bytes message stream |
void |
writeLong(long value)
Writes a
long to the bytes message stream |
void |
writeObject(java.lang.Object value)
Writes an object to the bytes message stream.
|
void |
writeShort(short value)
Writes a
short to the bytes message stream |
void |
writeUTF(java.lang.String value)
Writes a string that has been encoded using a UTF-8 format to the bytes
message stream
|
acknowledge, checkBodyWritePermissions, checkPropertyWritePermissions, clearProperties, convertExceptionToJMSException, convertExceptionToMessageFormatException, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSMessagePropertyValue, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getQueueUrl, getReceiptHandle, getShortProperty, getSQSMessageDeduplicationId, getSQSMessageGroupId, getSQSMessageId, getSQSMessageSequenceNumber, getStringProperty, propertyExists, setBodyWritePermissions, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setSequenceNumber, setShortProperty, setSQSMessageId, setStringPropertypublic SQSBytesMessage(Acknowledger acknowledger, java.lang.String queueUrl, Message sqsMessage) throws JMSException
JMSExceptionpublic SQSBytesMessage()
throws JMSException
JMSExceptionpublic long getBodyLength()
throws JMSException
MessageNotReadableException - If the message is in write-only mode.JMSExceptionpublic boolean readBoolean()
throws JMSException
boolean from the bytes message stream.boolean valueJMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public byte readByte()
throws JMSException
JMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public int readUnsignedByte()
throws JMSException
JMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public short readShort()
throws JMSException
JMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public int readUnsignedShort()
throws JMSException
JMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public char readChar()
throws JMSException
JMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public int readInt()
throws JMSException
JMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public long readLong()
throws JMSException
JMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public float readFloat()
throws JMSException
float from the bytes message stream.float value from the bytes message streamJMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public double readDouble()
throws JMSException
double from the bytes message stream.double value from the bytes message streamJMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public java.lang.String readUTF()
throws JMSException
JMSException - If the JMS provider fails to read the message due to some
internal error.MessageEOFException - If unexpected end of bytes stream has been reached.MessageNotReadableException - If the message is in write-only mode.public int readBytes(byte[] value)
throws JMSException
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.
value - The buffer into which the data is readJMSException - If the JMS provider fails to read the message due to some
internal error.MessageNotReadableException - If the message is in write-only mode.public int readBytes(byte[] value,
int length)
throws JMSException
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, then an IndexOutOfBoundsException is
thrown. No bytes will be read from the stream for this exception case.
value - The buffer into which the data is readlength - The number of bytes to read; must be less than or equal to
value.lengthJMSException - If the JMS provider fails to read the message due to some
internal error.MessageNotReadableException - If the message is in write-only mode.public void writeBoolean(boolean value)
throws JMSException
boolean to the bytes message streamvalue - The boolean value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeByte(byte value)
throws JMSException
byte to the bytes message streamvalue - The byte value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeShort(short value)
throws JMSException
short to the bytes message streamvalue - The short value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeChar(char value)
throws JMSException
char to the bytes message streamvalue - The char value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeInt(int value)
throws JMSException
int to the bytes message streamvalue - The int value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeLong(long value)
throws JMSException
long to the bytes message streamvalue - The long value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeFloat(float value)
throws JMSException
float to the bytes message streamvalue - The float value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeDouble(double value)
throws JMSException
double to the bytes message streamvalue - The double value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeUTF(java.lang.String value)
throws JMSException
value - The String value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeBytes(byte[] value)
throws JMSException
value - The byte array value to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeBytes(byte[] value,
int offset,
int length)
throws JMSException
value - The portion of byte array value to be writtenoffset - The initial offset within the byte arraylength - The number of bytes to useJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.public void writeObject(java.lang.Object value)
throws JMSException
This method works only for the boxed primitive object types (Integer, Double, Long ...), String objects, and byte arrays.
value - The Java object to be writtenJMSException - If the JMS provider fails to write the message due to some
internal error.MessageNotWriteableException - If the message is in read-only mode.MessageFormatException - If the object is of an invalid type.java.lang.NullPointerException - If the object is null.public void reset()
throws JMSException
JMSExceptionpublic void clearBody()
throws JMSException
clearBody in class SQSMessageJMSException - If directly calledpublic byte[] getBodyAsBytes()
throws JMSException
JMSException