Package com.ibm.mq.headers
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.
-
Field Summary
Fields inherited from class com.ibm.mq.jmqi.JmqiObject
COMP_JM, COMP_JN, COMP_JO -
Method Summary
Modifier and TypeMethodDescriptionabstract intstatic MQHeaderContextcreateMQHeaderContext(DataInput messageP) Create an MQMessageContext object to wrap a messagestatic MQHeaderContextcreateMQHeaderContext(DataInput messageP, String format, int encoding, int characterSet) Create an MQMessageContext object to wrap a messageabstract DataInputintget the character set of the next header or message content.intget the encoding of the next header or message content.get the format of the next header or message content.voidsetCharacterSet(int characterSet) Sets the CCSID of this message context, used in the decoding of headers.voidsetEncoding(int encoding) Sets the numeric encoding of this message context, used in the decoding of headers.voidSets the format of this message context, used in the decoding of headers.abstract intsniff()Methods inherited from class com.ibm.mq.jmqi.JmqiObject
getJmqiEnvironment
-
Method Details
-
createMQHeaderContext
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 wrappedformat- 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
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
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
- Returns:
- the number of bytes remaining to be read in the message.
- Throws:
IOException- if an error occurs reading message content
-
getDataInput
- Returns:
- the message.
-
sniff
- 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
-