Interface JmsBytesMessageFacade
- All Superinterfaces:
JmsMessageFacade,TraceableMessage
- All Known Implementing Classes:
AmqpJmsBytesMessageFacade
Interface for a Message Facade that wraps a BytesMessage based message
instance.
-
Method Summary
Modifier and TypeMethodDescriptioncopy()Performs a copy of this message facade into a new instance.byte[]copyBody()intCreate and return an InputStream instance that can be used to read the contents of this message.Create and return a new OuputStream used to populate the body of the message.voidreset()Reset the message state such that a call to getInputStream or getOutputStream will succeed.Methods inherited from interface org.apache.qpid.jms.message.facade.JmsMessageFacade
clearBody, clearProperties, encodeMessage, getCorrelationId, getCorrelationIdBytes, getDeliveryCount, getDeliveryTime, getDestination, getExpiration, getGroupId, getGroupSequence, getMessageId, getPriority, getProperty, getPropertyNames, getProviderMessageIdObject, getRedeliveryCount, getReplyTo, getTimestamp, getType, getUserId, getUserIdBytes, hasBody, isDeliveryTimeTransmitted, isPersistent, isRedelivered, onDispatch, onSend, propertyExists, setCorrelationId, setCorrelationIdBytes, setDeliveryCount, setDeliveryTime, setDestination, setExpiration, setGroupId, setGroupSequence, setMessageId, setPersistent, setPriority, setProperty, setProviderMessageIdObject, setRedelivered, setRedeliveryCount, setReplyTo, setTimestamp, setType, setUserId, setUserIdBytesMethods inherited from interface org.apache.qpid.jms.tracing.TraceableMessage
filterTracingAnnotations, getTracingAnnotation, getTracingContext, removeTracingAnnotation, removeTracingContext, setTracingAnnotation, setTracingContext
-
Method Details
-
copy
Performs a copy of this message facade into a new instance. Calling this method results in a call to reset() prior to the message copy meaning any in use streams will be closed on return.- Specified by:
copyin interfaceJmsMessageFacade- Returns:
- a deep copy of this Message Facade including a complete copy of the byte contents of the wrapped message.
- Throws:
jakarta.jms.JMSException- if an error occurs while copying the message.
-
getInputStream
Create and return an InputStream instance that can be used to read the contents of this message. If an OutputStream was previously created and no call to reset has yet been made then this method will throw an exception. Multiple calls to this method should return the same InputStream instance, only when the message has been reset should the current input stream instance be discarded and a new one created on demand. While this means the multiple concurrent readers is possible it is strongly discouraged. If the message body contains data that has been compressed and can be determined to be so by the implementation then this method will return an InputStream instance that can inflate the compressed data.- Returns:
- an InputStream instance to read the message body.
- Throws:
jakarta.jms.JMSException- if an error occurs creating the stream.jakarta.jms.IllegalStateException- if there is a current OutputStream in use.
-
getOutputStream
Create and return a new OuputStream used to populate the body of the message. If an InputStream was previously requested this method will fail until such time as a call to reset has been requested. If an existing OuputStream has already been created then this method will return that stream until such time as the reset method has been called.- Returns:
- an OutputStream instance to write the message body.
- Throws:
jakarta.jms.JMSException- if an error occurs creating the stream.jakarta.jms.IllegalStateException- if there is a current OutputStream in use.
-
reset
void reset()Reset the message state such that a call to getInputStream or getOutputStream will succeed. If an OutputStream instance exists it is closed an the current contents are stored into the message body. -
getBodyLength
int getBodyLength()- Returns:
- the number of bytes contained in the body of the message.
-
copyBody
byte[] copyBody()- Returns:
- a copy of the bytes contained in the body of the message.
-