com.ibm.mq.headers

Class MQRFH2

  • java.lang.Object
    • com.ibm.mq.jmqi.JmqiObject
      • com.ibm.mq.headers.internal.Header
        • com.ibm.mq.headers.MQRFH2
  • All Implemented Interfaces:
    MQChainable, MQData, MQHeader


    public class MQRFH2
    extends com.ibm.mq.headers.internal.Header
    implements MQChainable
    Header class representing the MQRFH2 structure. As well as providing access to the structure-defined header fields, this class provides methods to retrieve and set fields from XML format folders contained in the NameValueData variable-length field.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static interface  MQRFH2.Element
      The Element interface to get and set values
    • Field Summary

      • Fields inherited from class com.ibm.mq.headers.internal.Header

        DEFAULT_CCSID, DEFAULT_ENCODING, delegate
      • Fields inherited from class com.ibm.mq.jmqi.JmqiObject

        COMP_JM, COMP_JN, COMP_JO
    • Constructor Summary

      Constructors 
      Constructor and Description
      MQRFH2()
      Constructs an MQRFH2 instance with default field values.
      MQRFH2(java.io.DataInput message)
      Constructs an MQRFH2 instance populated from an MQMessage.
      MQRFH2(java.io.DataInput message, int encoding, int characterSet)
      Constructs an MQRFH2 instance populated from a DataInput source.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      java.lang.String format() 
      boolean getBooleanFieldValue(java.lang.String folder, java.lang.String field)
      Get the boolean value of the specified field
      byte getByteFieldValue(java.lang.String folder, java.lang.String field)
      Get the byte value of the specified field
      byte[] getBytesFieldValue(java.lang.String folder, java.lang.String field)
      Get the byte array value of the specified field
      char getCharFieldValue(java.lang.String folder, java.lang.String field)
      Get the byte value of the specified field
      int getCodedCharSetId()
      Get the Character set identifier of data that follows.
      double getDoubleFieldValue(java.lang.String folder, java.lang.String field)
      Get the double precision floating point value of the specified field
      int getEncoding()
      Get the numeric encoding of the data that follows.
      java.lang.Object getFieldValue(java.lang.String folder, java.lang.String tag) 
      java.lang.Object getFieldValue(java.lang.String folder, java.lang.String field, int occurrenceP) 
      java.util.List getFieldValues(java.lang.String folder, java.lang.String field) 
      int getFlags()
      get the flags from the header
      float getFloatFieldValue(java.lang.String folder, java.lang.String field)
      Get the floating point value of the specified field
      java.lang.String getFolderContent(java.lang.String name)
      Deprecated.  
      java.lang.String[] getFolderStrings() 
      java.lang.String getFormat()
      Get the format name of data that follows NameValueString
      int getIntFieldValue(java.lang.String folder, java.lang.String field)
      Get the integer value of the specified field
      long getLongFieldValue(java.lang.String folder, java.lang.String field)
      Get the long value of the specified field
      int getNameValueCCSID()
      get the coded character set for the NameValue data
      byte[] getNameValueData()
      get the NameValue data
      int getNameValueLength() 
      short getShortFieldValue(java.lang.String folder, java.lang.String field)
      Get the short value of the specified field
      java.lang.String getStringFieldValue(java.lang.String folder, java.lang.String field)
      Get the String value of the specified field
      java.lang.String getStrucId()
      Get the structure identifier; the value will be MQRFH_STRUC_ID
      int getStrucLength()
      Get the length of the structure.
      int getVersion()
      Get the Structure version number
      int nextCharacterSet() 
      void nextCharacterSet(int value)
      Sets the CCSID of the next header or message content.
      int nextEncoding() 
      void nextEncoding(int value)
      Sets the numeric encoding of the next header or message content.
      java.lang.String nextFormat() 
      void nextFormat(java.lang.String value)
      Sets the format of the next header or message content.
      int read(java.io.DataInput input, int encoding, int characterSet)
      Initialise this Header from the specified data source
      void setByteFieldValue(java.lang.String folder, java.lang.String field, byte value)
      Set the byte value of the specified field
      void setCharFieldValue(java.lang.String folder, java.lang.String field, char value)
      Set the short value of the specified field
      void setCodedCharSetId(int value)
      Set the Character set identifier of data that follows.
      void setDoubleFieldValue(java.lang.String folder, java.lang.String field, double value)
      Set the double precision floating point value of the specified field
      void setEncoding(int value)
      Set the numeric encoding of the data that follows.
      void setFieldValue(java.lang.String folder, java.lang.String field, java.lang.Object value)
      set value of a field
      void setFieldValues(java.lang.String folder, java.lang.String field, java.util.List values)
      set the values of a multi-valued field
      void setFlags(int value)
      set the flags on the header
      void setFloatFieldValue(java.lang.String folder, java.lang.String field, float value)
      Set the floating point value of the specified field
      void setFolderContent(java.lang.String name, java.lang.String content)
      Deprecated.  
      void setFolderStrings(java.lang.String[] folders)
      Replaces content of the variable part of the MQRFH2 structure with the specified array of strings.
      void setFormat(java.lang.String value)
      Set the format name of data that follows NameValueString
      void setIntFieldValue(java.lang.String folder, java.lang.String field, int value)
      Set the integer value of the specified field
      void setLongFieldValue(java.lang.String folder, java.lang.String field, long value)
      Set the long value of the specified field
      void setNameValueCCSID(int value)
      set the coded character set for the NameValue data
      void setNameValueData(byte[] value)
      Sets the NameValueData field.
      void setNameValueData(java.lang.String value)
      Sets the NameValueData field.
      void setShortFieldValue(java.lang.String folder, java.lang.String field, short value)
      Set the short value of the specified field
      int size() 
      java.lang.String toString() 
      int write(java.io.DataOutput outputP, int encoding, int characterSet)
      write this Header to the specified location
      • Methods inherited from class com.ibm.mq.headers.internal.Header

        characterSet, encoding, fields, getBytesValue, getCharValue, getCharValue, getIntValue, getJmqiEnv, getStringValue, getValue, headerType, read, read, setBytesValue, setCharValue, setCharValue, setIntValue, setStringValue, setValue, store, store, type, validate, write
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MQRFH2

        public MQRFH2()
        Constructs an MQRFH2 instance with default field values.
      • MQRFH2

        public MQRFH2(java.io.DataInput message)
               throws MQDataException,
                      java.io.IOException
        Constructs an MQRFH2 instance populated from an MQMessage.
        Parameters:
        message - the message to read
        Throws:
        MQDataException - if the message content does not yield a valid MQRFH2 stucture
        java.io.IOException - if there is a problem reading the message content
      • MQRFH2

        public MQRFH2(java.io.DataInput message,
                      int encoding,
                      int characterSet)
               throws MQDataException,
                      java.io.IOException
        Constructs an MQRFH2 instance populated from a DataInput source.
        Parameters:
        message - the MQMessage or other DataInput source to read
        encoding - the initial numeric encoding of the data in the message
        characterSet - the initial CCSID of the data in the message
        Throws:
        MQDataException - if the message content does not yield a valid MQRFH2 stucture
        java.io.IOException - if there is a problem reading the message content
    • Method Detail

      • read

        public int read(java.io.DataInput input,
                        int encoding,
                        int characterSet)
                 throws java.io.IOException,
                        MQDataException
        Initialise this Header from the specified data source
        Specified by:
        read in interface MQData
        Overrides:
        read in class com.ibm.mq.headers.internal.Header
        Parameters:
        input - the data source
        encoding - the encoding mechanism for integer data
        characterSet - the CCSID applied to data in the source
        Returns:
        the amount of data read
        Throws:
        java.io.IOException
        MQDataException
      • write

        public int write(java.io.DataOutput outputP,
                         int encoding,
                         int characterSet)
                  throws java.io.IOException
        write this Header to the specified location
        Specified by:
        write in interface MQData
        Overrides:
        write in class com.ibm.mq.headers.internal.Header
        Parameters:
        outputP - the data location
        encoding - the encoding mechanism for integer data
        characterSet - the CCSID applied to data in the data location
        Returns:
        the amount of data written
        Throws:
        java.io.IOException
      • size

        public int size()
        Specified by:
        size in interface MQData
        Overrides:
        size in class com.ibm.mq.headers.internal.Header
        Returns:
        the size in bytes occupied by this data element in a message.
        See Also:
        Header.size()
      • format

        public java.lang.String format()
        Specified by:
        format in interface MQChainable
        Returns:
        the format associated with this header object or message content.
        See Also:
        MQChainable.format()
      • getStrucId

        public java.lang.String getStrucId()
        Get the structure identifier; the value will be MQRFH_STRUC_ID
        Returns:
        the structure identifier
      • getVersion

        public int getVersion()
        Get the Structure version number
        Returns:
        the Structure version number
      • getStrucLength

        public int getStrucLength()
        Get the length of the structure.
        Returns:
        the structure length.
      • getEncoding

        public int getEncoding()
        Get the numeric encoding of the data that follows.
        Returns:
        the numeric encoding. A combination of MQENC_* values.
      • setEncoding

        public void setEncoding(int value)
        Set the numeric encoding of the data that follows.
        Parameters:
        value - the numeric encoding. A combination of MQENC_* values.
      • getCodedCharSetId

        public int getCodedCharSetId()
        Get the Character set identifier of data that follows.
        Returns:
        the Character set identifier.
      • setCodedCharSetId

        public void setCodedCharSetId(int value)
        Set the Character set identifier of data that follows. MQCCSI_Q_MGR is not allowable, so we map that to MQCCSI_INHERIT (I think this is the simplest fix)
        Parameters:
        value - the Character set identifier.
      • getFormat

        public java.lang.String getFormat()
        Get the format name of data that follows NameValueString
        Returns:
        the format name
      • setFormat

        public void setFormat(java.lang.String value)
        Set the format name of data that follows NameValueString
        Parameters:
        value - the format name
      • getFlags

        public int getFlags()
        get the flags from the header
        Returns:
        the flags
      • setFlags

        public void setFlags(int value)
        set the flags on the header
        Parameters:
        value - the flags
      • getNameValueCCSID

        public int getNameValueCCSID()
        get the coded character set for the NameValue data
        Returns:
        the NameValue data
      • setNameValueCCSID

        public void setNameValueCCSID(int value)
        set the coded character set for the NameValue data
        Parameters:
        value - the coded character set for the NameValue data
      • getNameValueLength

        public int getNameValueLength()
        Returns:
        the NameValueLength field value.

        Note: There is no setNameValueLength method. Setting the NameValueData field causes the NameValueLength and StrucLength field values to be updated accordingly.

      • getNameValueData

        public byte[] getNameValueData()
        get the NameValue data
        Returns:
        the NameValue data
      • setNameValueData

        public void setNameValueData(byte[] value)
        Sets the NameValueData field. This causes the NameValueLength and StrucLength field values to be updated accordingly, but the NameValueCCSID field is not modified.
        Parameters:
        value -
      • setNameValueData

        public void setNameValueData(java.lang.String value)
                              throws java.io.IOException
        Sets the NameValueData field. This causes the NameValueLength and StrucLength field values to be updated accordingly. The string data is converted to the CCSID indicated in the NameValueCCSID field.
        Parameters:
        value -
        Throws:
        java.io.IOException
      • getFolderStrings

        public java.lang.String[] getFolderStrings()
                                            throws java.io.IOException
        Returns:
        the contents of the variable part of the structure as an array of Strings. This is equivalent to an array of NameValueData strings.
        Throws:
        java.io.IOException
      • setFolderStrings

        public void setFolderStrings(java.lang.String[] folders)
                              throws java.io.IOException
        Replaces content of the variable part of the MQRFH2 structure with the specified array of strings. The strucLength field is updated accordingly.
        Parameters:
        folders -
        Throws:
        java.io.IOException
      • getFolderContent

        public java.lang.String getFolderContent(java.lang.String name)
                                          throws java.io.IOException
        Deprecated. 
        Parameters:
        name -
        Returns:
        a string from the MQRFH2 contents corresponding to the named folder, or null if no such folder is present. The content of the folder string (less the enclosing folder tags) is returned if there is a match.
        Throws:
        java.io.IOException
      • setFolderContent

        public void setFolderContent(java.lang.String name,
                                     java.lang.String content)
                              throws java.io.IOException
        Deprecated. 
        Sets the content of the named folder. If the folder exists, its content is replaced unless the content argument is null, in which case the folder is removed. If the folder does not exist, it is added unless the content argument is null.
        Parameters:
        name -
        content -
        Throws:
        java.io.IOException
      • getFieldValue

        public java.lang.Object getFieldValue(java.lang.String folder,
                                              java.lang.String tag)
                                       throws java.io.IOException
        Parameters:
        folder -
        tag -
        Returns:
        the contents of the first field with the specified name from within a folder string, or null if no such field is present. The content of the field (less the enclosing field tags) is returned if there is a match.
        Throws:
        java.io.IOException
      • getFieldValue

        public java.lang.Object getFieldValue(java.lang.String folder,
                                              java.lang.String field,
                                              int occurrenceP)
                                       throws java.io.IOException
        Parameters:
        folder -
        field -
        occurrenceP -
        Returns:
        the contents of the nth field with the specified name from within a folder string, or null if no such field is present. The content of the field (less the enclosing field tags) is returned if there is a match. An occurrence of zero gets the first occurrence of the the named field; occurrence of 1 get the next occurrence, and so forth.
        Throws:
        java.io.IOException
      • getFieldValues

        public java.util.List getFieldValues(java.lang.String folder,
                                             java.lang.String field)
                                      throws java.io.IOException
        Parameters:
        folder -
        field -
        Returns:
        a list containing all occurrences of field values matching the specified field name in the folder. The list is empty if there are no matching fields or the folder is not found.
        Throws:
        java.io.IOException
      • setFieldValue

        public void setFieldValue(java.lang.String folder,
                                  java.lang.String field,
                                  java.lang.Object value)
                           throws java.io.IOException
        set value of a field
        Parameters:
        folder - - the name of the folder containing the field
        field - - the field name
        value - - the field value
        Throws:
        java.io.IOException
      • setFieldValues

        public void setFieldValues(java.lang.String folder,
                                   java.lang.String field,
                                   java.util.List values)
                            throws java.io.IOException
        set the values of a multi-valued field
        Parameters:
        folder - - the name of the folder containing the field
        field - - the field name
        values - - the field values
        Throws:
        java.io.IOException
      • getBooleanFieldValue

        public boolean getBooleanFieldValue(java.lang.String folder,
                                            java.lang.String field)
                                     throws java.io.IOException
        Get the boolean value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the boolean value
        Throws:
        java.io.IOException
      • getIntFieldValue

        public int getIntFieldValue(java.lang.String folder,
                                    java.lang.String field)
                             throws java.io.IOException
        Get the integer value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the integer value
        Throws:
        java.io.IOException
      • setIntFieldValue

        public void setIntFieldValue(java.lang.String folder,
                                     java.lang.String field,
                                     int value)
                              throws java.io.IOException
        Set the integer value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        value - the value to set
        Throws:
        java.io.IOException
      • getByteFieldValue

        public byte getByteFieldValue(java.lang.String folder,
                                      java.lang.String field)
                               throws java.io.IOException
        Get the byte value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the byte value
        Throws:
        java.io.IOException
      • setByteFieldValue

        public void setByteFieldValue(java.lang.String folder,
                                      java.lang.String field,
                                      byte value)
                               throws java.io.IOException
        Set the byte value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        value - the value to set
        Throws:
        java.io.IOException
      • getShortFieldValue

        public short getShortFieldValue(java.lang.String folder,
                                        java.lang.String field)
                                 throws java.io.IOException
        Get the short value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the short value
        Throws:
        java.io.IOException
      • setShortFieldValue

        public void setShortFieldValue(java.lang.String folder,
                                       java.lang.String field,
                                       short value)
                                throws java.io.IOException
        Set the short value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        value - the value to set
        Throws:
        java.io.IOException
      • getCharFieldValue

        public char getCharFieldValue(java.lang.String folder,
                                      java.lang.String field)
                               throws java.io.IOException
        Get the byte value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the byte value
        Throws:
        java.io.IOException
      • setCharFieldValue

        public void setCharFieldValue(java.lang.String folder,
                                      java.lang.String field,
                                      char value)
                               throws java.io.IOException
        Set the short value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        value - the value to set
        Throws:
        java.io.IOException
      • getLongFieldValue

        public long getLongFieldValue(java.lang.String folder,
                                      java.lang.String field)
                               throws java.io.IOException
        Get the long value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the long value
        Throws:
        java.io.IOException
      • setLongFieldValue

        public void setLongFieldValue(java.lang.String folder,
                                      java.lang.String field,
                                      long value)
                               throws java.io.IOException
        Set the long value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        value - the value to set
        Throws:
        java.io.IOException
      • getFloatFieldValue

        public float getFloatFieldValue(java.lang.String folder,
                                        java.lang.String field)
                                 throws java.io.IOException
        Get the floating point value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the floating point value
        Throws:
        java.io.IOException
      • setFloatFieldValue

        public void setFloatFieldValue(java.lang.String folder,
                                       java.lang.String field,
                                       float value)
                                throws java.io.IOException
        Set the floating point value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        value - the value to set
        Throws:
        java.io.IOException
      • getDoubleFieldValue

        public double getDoubleFieldValue(java.lang.String folder,
                                          java.lang.String field)
                                   throws java.io.IOException
        Get the double precision floating point value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the double precision floating point value
        Throws:
        java.io.IOException
      • setDoubleFieldValue

        public void setDoubleFieldValue(java.lang.String folder,
                                        java.lang.String field,
                                        double value)
                                 throws java.io.IOException
        Set the double precision floating point value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        value - the value to set
        Throws:
        java.io.IOException
      • getBytesFieldValue

        public byte[] getBytesFieldValue(java.lang.String folder,
                                         java.lang.String field)
                                  throws java.io.IOException
        Get the byte array value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the byte array
        Throws:
        java.io.IOException
      • getStringFieldValue

        public java.lang.String getStringFieldValue(java.lang.String folder,
                                                    java.lang.String field)
                                             throws java.io.IOException
        Get the String value of the specified field
        Parameters:
        folder - the folder name in the Header
        field - the field name in the Header
        Returns:
        the String value
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class com.ibm.mq.headers.internal.Header
        See Also:
        Object.toString()
(c) Copyright IBM Corp. 2008, 2016. All Rights Reserved.