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
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 ClassesModifier and TypeClassDescriptionstatic interfaceThe Element interface to get and set valuesNested classes/interfaces inherited from interface MQHeader
MQHeader.Field -
Field Summary
Fields inherited from class com.ibm.mq.headers.internal.Header
DEFAULT_CCSID, DEFAULT_ENCODING, delegateFields inherited from class com.ibm.mq.jmqi.JmqiObject
COMP_JM, COMP_JN, COMP_JO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformat()booleangetBooleanFieldValue(String folder, String field) Get the boolean value of the specified fieldbytegetByteFieldValue(String folder, String field) Get the byte value of the specified fieldbyte[]getBytesFieldValue(String folder, String field) Get the byte array value of the specified fieldchargetCharFieldValue(String folder, String field) Get the byte value of the specified fieldintGet the Character set identifier of data that follows.doublegetDoubleFieldValue(String folder, String field) Get the double precision floating point value of the specified fieldintGet the numeric encoding of the data that follows.getFieldValue(String folder, String tag) getFieldValue(String folder, String field, int occurrenceP) getFieldValues(String folder, String field) intgetFlags()get the flags from the headerfloatgetFloatFieldValue(String folder, String field) Get the floating point value of the specified fieldgetFolderContent(String name) Deprecated.String[]Get the format name of data that follows NameValueStringintgetIntFieldValue(String folder, String field) Get the integer value of the specified fieldlonggetLongFieldValue(String folder, String field) Get the long value of the specified fieldintget the coded character set for the NameValue databyte[]get the NameValue dataintshortgetShortFieldValue(String folder, String field) Get the short value of the specified fieldgetStringFieldValue(String folder, String field) Get the String value of the specified fieldGet the structure identifier; the value will be MQRFH_STRUC_IDintGet the length of the structure.intGet the Structure version numberintvoidnextCharacterSet(int value) Sets the CCSID of the next header or message content.intvoidnextEncoding(int value) Sets the numeric encoding of the next header or message content.voidnextFormat(String value) Sets the format of the next header or message content.intInitialise this Header from the specified data sourcevoidsetByteFieldValue(String folder, String field, byte value) Set the byte value of the specified fieldvoidsetCharFieldValue(String folder, String field, char value) Set the short value of the specified fieldvoidsetCodedCharSetId(int value) Set the Character set identifier of data that follows.voidsetDoubleFieldValue(String folder, String field, double value) Set the double precision floating point value of the specified fieldvoidsetEncoding(int value) Set the numeric encoding of the data that follows.voidsetFieldValue(String folder, String field, Object value) set value of a fieldvoidsetFieldValues(String folder, String field, List values) set the values of a multi-valued fieldvoidsetFlags(int value) set the flags on the headervoidsetFloatFieldValue(String folder, String field, float value) Set the floating point value of the specified fieldvoidsetFolderContent(String name, String content) Deprecated.voidsetFolderStrings(String[] folders) Replaces content of the variable part of the MQRFH2 structure with the specified array of strings.voidSet the format name of data that follows NameValueStringvoidsetIntFieldValue(String folder, String field, int value) Set the integer value of the specified fieldvoidsetLongFieldValue(String folder, String field, long value) Set the long value of the specified fieldvoidsetNameValueCCSID(int value) set the coded character set for the NameValue datavoidsetNameValueData(byte[] value) Sets the NameValueData field.voidsetNameValueData(String value) Sets the NameValueData field.voidsetShortFieldValue(String folder, String field, short value) Set the short value of the specified fieldintsize()toString()intwrite(DataOutput outputP, int encoding, int characterSet) write this Header to the specified locationMethods 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, writeMethods inherited from class com.ibm.mq.jmqi.JmqiObject
getJmqiEnvironment
-
Constructor Details
-
MQRFH2
public MQRFH2()Constructs an MQRFH2 instance with default field values. -
MQRFH2
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 stuctureIOException- if there is a problem reading the message content
-
MQRFH2
public MQRFH2(DataInput message, int encoding, int characterSet) throws MQDataException, IOException Constructs an MQRFH2 instance populated from a DataInput source.- Parameters:
message- the MQMessage or other DataInput source to readencoding- the initial numeric encoding of the data in the messagecharacterSet- the initial CCSID of the data in the message- Throws:
MQDataException- if the message content does not yield a valid MQRFH2 stuctureIOException- if there is a problem reading the message content
-
-
Method Details
-
read
public int read(DataInput input, int encoding, int characterSet) throws IOException, MQDataException Initialise this Header from the specified data source- Specified by:
readin interfaceMQData- Overrides:
readin classcom.ibm.mq.headers.internal.Header- Parameters:
input- the data sourceencoding- the encoding mechanism for integer datacharacterSet- the CCSID applied to data in the source- Returns:
- the amount of data read
- Throws:
IOException- if an error occurs reading message content.MQDataException- if there is a problem reading the message content
-
write
write this Header to the specified location- Specified by:
writein interfaceMQData- Overrides:
writein classcom.ibm.mq.headers.internal.Header- Parameters:
outputP- the data locationencoding- the encoding mechanism for integer datacharacterSet- the CCSID applied to data in the data location- Returns:
- the amount of data written
- Throws:
IOException- if an error occurs writing message content.
-
size
-
nextEncoding
public int nextEncoding()- Specified by:
nextEncodingin interfaceMQChainable- Returns:
- the numeric encoding of the next header or message content.
- See Also:
-
nextEncoding
public void nextEncoding(int value) Description copied from interface:MQChainableSets the numeric encoding of the next header or message content.- Specified by:
nextEncodingin interfaceMQChainable- Parameters:
value- numeric encoding- See Also:
-
nextCharacterSet
public int nextCharacterSet()- Specified by:
nextCharacterSetin interfaceMQChainable- Returns:
- the CCSID of the next header or message content.
- See Also:
-
nextCharacterSet
public void nextCharacterSet(int value) Description copied from interface:MQChainableSets the CCSID of the next header or message content.- Specified by:
nextCharacterSetin interfaceMQChainable- Parameters:
value- character set- See Also:
-
nextFormat
- Specified by:
nextFormatin interfaceMQChainable- Returns:
- the format of the next header or message content.
- See Also:
-
nextFormat
Description copied from interface:MQChainableSets the format of the next header or message content.- Specified by:
nextFormatin interfaceMQChainable- Parameters:
value- format of the header or message content- See Also:
-
format
- Specified by:
formatin interfaceMQChainable- Returns:
- the format associated with this header object or message content.
- See Also:
-
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
Get the format name of data that follows NameValueString- Returns:
- the format name
-
setFormat
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
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:
IOException
-
getFolderStrings
- 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:
IOException
-
setFolderStrings
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:
IOException
-
getFolderContent
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:
IOException
-
setFolderContent
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:
IOException
-
getFieldValue
- 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:
IOException
-
getFieldValue
- 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:
IOException
-
getFieldValues
- 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:
IOException
-
setFieldValue
set value of a field- Parameters:
folder- - the name of the folder containing the fieldfield- - the field namevalue- - the field value- Throws:
IOException
-
setFieldValues
set the values of a multi-valued field- Parameters:
folder- - the name of the folder containing the fieldfield- - the field namevalues- - the field values- Throws:
IOException
-
getBooleanFieldValue
Get the boolean value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the boolean value
- Throws:
IOException
-
getIntFieldValue
Get the integer value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the integer value
- Throws:
IOException
-
setIntFieldValue
Set the integer value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Headervalue- the value to set- Throws:
IOException
-
getByteFieldValue
Get the byte value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the byte value
- Throws:
IOException
-
setByteFieldValue
Set the byte value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Headervalue- the value to set- Throws:
IOException
-
getShortFieldValue
Get the short value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the short value
- Throws:
IOException
-
setShortFieldValue
Set the short value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Headervalue- the value to set- Throws:
IOException
-
getCharFieldValue
Get the byte value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the byte value
- Throws:
IOException
-
setCharFieldValue
Set the short value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Headervalue- the value to set- Throws:
IOException
-
getLongFieldValue
Get the long value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the long value
- Throws:
IOException
-
setLongFieldValue
Set the long value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Headervalue- the value to set- Throws:
IOException
-
getFloatFieldValue
Get the floating point value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the floating point value
- Throws:
IOException
-
setFloatFieldValue
Set the floating point value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Headervalue- the value to set- Throws:
IOException
-
getDoubleFieldValue
Get the double precision floating point value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the double precision floating point value
- Throws:
IOException
-
setDoubleFieldValue
Set the double precision floating point value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Headervalue- the value to set- Throws:
IOException
-
getBytesFieldValue
Get the byte array value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the byte array
- Throws:
IOException
-
getStringFieldValue
Get the String value of the specified field- Parameters:
folder- the folder name in the Headerfield- the field name in the Header- Returns:
- the String value
- Throws:
IOException
-
toString
- Overrides:
toStringin classcom.ibm.mq.headers.internal.Header- See Also:
-