com.ibm.mq.pcf
Class MQCFH
java.lang.Object
|
+--com.ibm.mq.pcf.PCFHeader
|
+--com.ibm.mq.pcf.MQCFH
- public class MQCFH
- extends PCFHeader
A class encapsulating the MQCFH (PCF header) structure.
New in version 2.0:
- The MQCFH(MQMessage) constructor and initialize(MQMessage) method
no longer throw an InstantiationException if the message data does not yield a valid
MQCFH structure. Instead, an MQException is thrown with the appropriate MQRCCF_*
reason code.
- Version:
- 2.2
- Author:
- Chris Markes
Constructor Summary |
MQCFH()
Default constructor. |
MQCFH(int command,
int parameterCount)
Initializes an MQCFH instance with the specified command and parameter count. |
MQCFH(com.ibm.mq.MQMessage message)
Initializes a new MQCFH instance by reading from an MQMessage. |
Method Summary |
void |
initialize(com.ibm.mq.MQMessage message)
Initializes the contents of an MQCFH by reading from an MQMessage. |
int |
size()
Returns the size in bytes of this MQCFH header (this will always be
MQCFH_STRUC_LENGTH). |
java.lang.String |
toString()
|
int |
write(com.ibm.mq.MQMessage message)
Writes the contents of this MQCFH to an MQMessage. |
static int |
write(com.ibm.mq.MQMessage message,
int command,
int param_count)
A convenience method for writing an MQCFH header structure with the specified
values to a message. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
copyright
public static final java.lang.String copyright
type
public int type
strucLength
public static final int strucLength
version
public int version
command
public int command
msgSeqNumber
public int msgSeqNumber
control
public int control
compCode
public int compCode
reason
public int reason
parameterCount
public int parameterCount
MQCFH
public MQCFH()
- Default constructor. Initializes an MQCFH instance with
- type: MQCFT_COMMAND
- strucLength: MQCFH_STRUC_LENGTH
- version: MQCFH_VERSION_1
- msgSeqNumber: 1
- control: MQCFC_LAST
- other values set to zero
MQCFH
public MQCFH(int command,
int parameterCount)
- Initializes an MQCFH instance with the specified command and parameter count. Other
values are set as for the no-args constructor.
MQCFH
public MQCFH(com.ibm.mq.MQMessage message)
throws com.ibm.mq.MQException,
java.io.IOException
- Initializes a new MQCFH instance by reading from an MQMessage.
- Parameters:
message
- the message to read from- Throws:
com.ibm.mq.MQException
- if the message contents do not yield a valid
MQCFH structurejava.io.IOException
- if there is a problem reading the message
write
public static int write(com.ibm.mq.MQMessage message,
int command,
int param_count)
throws java.io.IOException
- A convenience method for writing an MQCFH header structure with the specified
values to a message.
- Parameters:
message
- the message to write tocommand
- the PCF command (MQCMD_* constants are defined in the CMQCFC class)parm_count
- the number of parameter structures (MQCFIN, MQCFIL, MQCFST or
MQCFSL) to follow the PCF header- See Also:
CMQCFC
,
MQCFIN
,
MQCFIL
,
MQCFST
,
MQCFSL
initialize
public void initialize(com.ibm.mq.MQMessage message)
throws com.ibm.mq.MQException,
java.io.IOException
- Initializes the contents of an MQCFH by reading from an MQMessage.
- Overrides:
initialize
in class PCFHeader
- Parameters:
message
- the message to read from- Throws:
com.ibm.mq.MQException
- if the message contents do not yield a valid
MQCFH structure:
- if the type field is invalid, the reason code is
MQRCCF_CFH_TYPE_ERROR
- if the strucLength field is invalid, the reason code is
MQRCCF_CFH_LENGTH_ERROR
java.io.IOException
- if there is a problem reading the message
write
public int write(com.ibm.mq.MQMessage message)
throws java.io.IOException
- Writes the contents of this MQCFH to an MQMessage.
- Overrides:
write
in class PCFHeader
- Parameters:
message
- the message to write to- Throws:
java.io.IOException
- if there is a problem writing the message
size
public int size()
- Returns the size in bytes of this MQCFH header (this will always be
MQCFH_STRUC_LENGTH).
- Overrides:
size
in class PCFHeader
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object