Class MQHeaderContext

java.lang.Object
com.ibm.mq.jmqi.JmqiObject
com.ibm.mq.headers.MQHeaderContext

public abstract class MQHeaderContext extends com.ibm.mq.jmqi.JmqiObject
An MQMessageContext is used by instances of MQHeaderFactory when decoding message content. An MQMessageContext encapsulates a message and the current format, encoding and CCSID associated with its content at the current position.
  • Method Details

    • createMQHeaderContext

      public static MQHeaderContext createMQHeaderContext(DataInput messageP)
      Create an MQMessageContext object to wrap a message
      Parameters:
      messageP - the message to be wrapped
      Returns:
      an appropriate MQHeaderContext implementation
    • createMQHeaderContext

      public static MQHeaderContext createMQHeaderContext(DataInput messageP, String format, int encoding, int characterSet)
      Create an MQMessageContext object to wrap a message
      Parameters:
      messageP - the message to be wrapped
      format - the message format (see CMQC.MQFMT_*)
      encoding - the message encoding (see CMQC.MQENV_*)
      characterSet - the Coded Character Set id
      Returns:
      an appropriate MQHeaderContext implementation
    • nextFormat

      public String nextFormat()
      get the format of the next header or message content.
      Returns:
      the format of the next header or message content.
    • nextEncoding

      public int nextEncoding()
      get the encoding of the next header or message content.
      Returns:
      the encoding of the next header or message content.
    • nextCharacterSet

      public int nextCharacterSet()
      get the character set of the next header or message content.
      Returns:
      the character set of the next header or message content.
    • setFormat

      public void setFormat(String format)
      Sets the format of this message context, used in the decoding of headers.
      Parameters:
      format - the format of this message context.
    • setEncoding

      public void setEncoding(int encoding)
      Sets the numeric encoding of this message context, used in the decoding of headers.
      Parameters:
      encoding - the numeric encoding. see (CMQC.MQENC_* for values).
    • setCharacterSet

      public void setCharacterSet(int characterSet)
      Sets the CCSID of this message context, used in the decoding of headers.
      Parameters:
      characterSet - the Coded Character Set Identifier.
    • available

      public abstract int available() throws IOException
      Returns:
      the number of bytes remaining to be read in the message.
      Throws:
      IOException - if an error occurs reading message content
    • getDataInput

      public abstract DataInput getDataInput()
      Returns:
      the message.
    • sniff

      public abstract int sniff() throws IOException
      Returns:
      the next four bytes in the message as an integer, and rewinds the message to the current position.
      Throws:
      IOException - if an error occurs reading message content