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.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract int
available()
static MQHeaderContext
createMQHeaderContext(java.io.DataInput messageP)
Create an MQMessageContext object to wrap a messagestatic MQHeaderContext
createMQHeaderContext(java.io.DataInput messageP, java.lang.String format, int encoding, int characterSet)
Create an MQMessageContext object to wrap a messageabstract java.io.DataInput
getDataInput()
int
nextCharacterSet()
get the character set of the next header or message content.int
nextEncoding()
get the encoding of the next header or message content.java.lang.String
nextFormat()
get the format of the next header or message content.void
setCharacterSet(int characterSet)
Sets the CCSID of this message context, used in the decoding of headers.void
setEncoding(int encoding)
Sets the numeric encoding of this message context, used in the decoding of headers.void
setFormat(java.lang.String format)
Sets the format of this message context, used in the decoding of headers.abstract int
sniff()
-
-
-
Method Detail
-
createMQHeaderContext
public static MQHeaderContext createMQHeaderContext(java.io.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(java.io.DataInput messageP, java.lang.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
public java.lang.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(java.lang.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 java.io.IOException
- Returns:
- the number of bytes remaining to be read in the message.
- Throws:
java.io.IOException
-
getDataInput
public abstract java.io.DataInput getDataInput()
- Returns:
- the message.
-
sniff
public abstract int sniff() throws java.io.IOException
- Returns:
- the next four bytes in the message as an integer, and rewinds the message to the current position.
- Throws:
java.io.IOException
-
-