Interface JmsBytesMessageFacade

All Superinterfaces:
JmsMessageFacade, TraceableMessage
All Known Implementing Classes:
AmqpJmsBytesMessageFacade

public interface JmsBytesMessageFacade extends JmsMessageFacade
Interface for a Message Facade that wraps a BytesMessage based message instance.
  • Method Details

    • copy

      JmsBytesMessageFacade copy() throws jakarta.jms.JMSException
      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:
      copy in interface JmsMessageFacade
      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

      InputStream getInputStream() throws jakarta.jms.JMSException
      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

      OutputStream getOutputStream() throws jakarta.jms.JMSException
      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.