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:

Version:
2.2
Author:
Chris Markes

Field Summary
 int command
           
 int compCode
           
 int control
           
static java.lang.String copyright
           
 int msgSeqNumber
           
 int parameterCount
           
 int reason
           
static int strucLength
           
 int type
           
 int version
           
 
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
 

Field Detail

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
Constructor Detail

MQCFH

public MQCFH()
Default constructor. Initializes an MQCFH instance with

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 structure
java.io.IOException - if there is a problem reading the message
Method Detail

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 to
command - 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