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 interfaceMQRFH2.ElementThe Element interface to get and set values-
Nested classes/interfaces inherited from interface com.ibm.mq.headers.MQHeader
MQHeader.Field
-
-
Field Summary
-
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.Stringformat()booleangetBooleanFieldValue(java.lang.String folder, java.lang.String field)Get the boolean value of the specified fieldbytegetByteFieldValue(java.lang.String folder, java.lang.String field)Get the byte value of the specified fieldbyte[]getBytesFieldValue(java.lang.String folder, java.lang.String field)Get the byte array value of the specified fieldchargetCharFieldValue(java.lang.String folder, java.lang.String field)Get the byte value of the specified fieldintgetCodedCharSetId()Get the Character set identifier of data that follows.doublegetDoubleFieldValue(java.lang.String folder, java.lang.String field)Get the double precision floating point value of the specified fieldintgetEncoding()Get the numeric encoding of the data that follows.java.lang.ObjectgetFieldValue(java.lang.String folder, java.lang.String tag)java.lang.ObjectgetFieldValue(java.lang.String folder, java.lang.String field, int occurrenceP)java.util.ListgetFieldValues(java.lang.String folder, java.lang.String field)intgetFlags()get the flags from the headerfloatgetFloatFieldValue(java.lang.String folder, java.lang.String field)Get the floating point value of the specified fieldjava.lang.StringgetFolderContent(java.lang.String name)Deprecated.java.lang.String[]getFolderStrings()java.lang.StringgetFormat()Get the format name of data that follows NameValueStringintgetIntFieldValue(java.lang.String folder, java.lang.String field)Get the integer value of the specified fieldlonggetLongFieldValue(java.lang.String folder, java.lang.String field)Get the long value of the specified fieldintgetNameValueCCSID()get the coded character set for the NameValue databyte[]getNameValueData()get the NameValue dataintgetNameValueLength()shortgetShortFieldValue(java.lang.String folder, java.lang.String field)Get the short value of the specified fieldjava.lang.StringgetStringFieldValue(java.lang.String folder, java.lang.String field)Get the String value of the specified fieldjava.lang.StringgetStrucId()Get the structure identifier; the value will be MQRFH_STRUC_IDintgetStrucLength()Get the length of the structure.intgetVersion()Get the Structure version numberintnextCharacterSet()voidnextCharacterSet(int value)Sets the CCSID of the next header or message content.intnextEncoding()voidnextEncoding(int value)Sets the numeric encoding of the next header or message content.java.lang.StringnextFormat()voidnextFormat(java.lang.String value)Sets the format of the next header or message content.intread(java.io.DataInput input, int encoding, int characterSet)Initialise this Header from the specified data sourcevoidsetByteFieldValue(java.lang.String folder, java.lang.String field, byte value)Set the byte value of the specified fieldvoidsetCharFieldValue(java.lang.String folder, java.lang.String field, char value)Set the short value of the specified fieldvoidsetCodedCharSetId(int value)Set the Character set identifier of data that follows.voidsetDoubleFieldValue(java.lang.String folder, java.lang.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(java.lang.String folder, java.lang.String field, java.lang.Object value)set value of a fieldvoidsetFieldValues(java.lang.String folder, java.lang.String field, java.util.List values)set the values of a multi-valued fieldvoidsetFlags(int value)set the flags on the headervoidsetFloatFieldValue(java.lang.String folder, java.lang.String field, float value)Set the floating point value of the specified fieldvoidsetFolderContent(java.lang.String name, java.lang.String content)Deprecated.voidsetFolderStrings(java.lang.String[] folders)Replaces content of the variable part of the MQRFH2 structure with the specified array of strings.voidsetFormat(java.lang.String value)Set the format name of data that follows NameValueStringvoidsetIntFieldValue(java.lang.String folder, java.lang.String field, int value)Set the integer value of the specified fieldvoidsetLongFieldValue(java.lang.String folder, java.lang.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(java.lang.String value)Sets the NameValueData field.voidsetShortFieldValue(java.lang.String folder, java.lang.String field, short value)Set the short value of the specified fieldintsize()java.lang.StringtoString()intwrite(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
-
-
-
-
Constructor Detail
-
MQRFH2
public MQRFH2()
Constructs an MQRFH2 instance with default field values.
-
MQRFH2
public MQRFH2(java.io.DataInput message) throws MQDataException, java.io.IOExceptionConstructs 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 stucturejava.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.IOExceptionConstructs 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 stucturejava.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, MQDataExceptionInitialise 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:
java.io.IOExceptionMQDataException
-
write
public int write(java.io.DataOutput outputP, int encoding, int characterSet) throws java.io.IOExceptionwrite 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:
java.io.IOException
-
size
public int size()
-
nextEncoding
public int nextEncoding()
- Specified by:
nextEncodingin interfaceMQChainable- Returns:
- the numeric encoding of the next header or message content.
- See Also:
MQChainable.nextEncoding()
-
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- See Also:
MQChainable.nextEncoding(int)
-
nextCharacterSet
public int nextCharacterSet()
- Specified by:
nextCharacterSetin interfaceMQChainable- Returns:
- the CCSID of the next header or message content.
- See Also:
MQChainable.nextCharacterSet()
-
nextCharacterSet
public void nextCharacterSet(int value)
Description copied from interface:MQChainableSets the CCSID of the next header or message content.- Specified by:
nextCharacterSetin interfaceMQChainable- See Also:
MQChainable.nextCharacterSet(int)
-
nextFormat
public java.lang.String nextFormat()
- Specified by:
nextFormatin interfaceMQChainable- Returns:
- the format of the next header or message content.
- See Also:
MQChainable.nextFormat()
-
nextFormat
public void nextFormat(java.lang.String value)
Description copied from interface:MQChainableSets the format of the next header or message content.- Specified by:
nextFormatin interfaceMQChainable- See Also:
MQChainable.nextFormat(java.lang.String)
-
format
public java.lang.String format()
- Specified by:
formatin interfaceMQChainable- 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.IOExceptionSets 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.IOExceptionReplaces 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.IOExceptionDeprecated.- 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.IOExceptionDeprecated.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.IOExceptionset value of a field- Parameters:
folder- - the name of the folder containing the fieldfield- - the field namevalue- - 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.IOExceptionset the values of a multi-valued field- Parameters:
folder- - the name of the folder containing the fieldfield- - the field namevalues- - the field values- Throws:
java.io.IOException
-
getBooleanFieldValue
public boolean getBooleanFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
getIntFieldValue
public int getIntFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
setIntFieldValue
public void setIntFieldValue(java.lang.String folder, java.lang.String field, int value) throws java.io.IOExceptionSet 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:
java.io.IOException
-
getByteFieldValue
public byte getByteFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
setByteFieldValue
public void setByteFieldValue(java.lang.String folder, java.lang.String field, byte value) throws java.io.IOExceptionSet 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:
java.io.IOException
-
getShortFieldValue
public short getShortFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
setShortFieldValue
public void setShortFieldValue(java.lang.String folder, java.lang.String field, short value) throws java.io.IOExceptionSet 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:
java.io.IOException
-
getCharFieldValue
public char getCharFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
setCharFieldValue
public void setCharFieldValue(java.lang.String folder, java.lang.String field, char value) throws java.io.IOExceptionSet 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:
java.io.IOException
-
getLongFieldValue
public long getLongFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
setLongFieldValue
public void setLongFieldValue(java.lang.String folder, java.lang.String field, long value) throws java.io.IOExceptionSet 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:
java.io.IOException
-
getFloatFieldValue
public float getFloatFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
setFloatFieldValue
public void setFloatFieldValue(java.lang.String folder, java.lang.String field, float value) throws java.io.IOExceptionSet 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:
java.io.IOException
-
getDoubleFieldValue
public double getDoubleFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
setDoubleFieldValue
public void setDoubleFieldValue(java.lang.String folder, java.lang.String field, double value) throws java.io.IOExceptionSet 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:
java.io.IOException
-
getBytesFieldValue
public byte[] getBytesFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
getStringFieldValue
public java.lang.String getStringFieldValue(java.lang.String folder, java.lang.String field) throws java.io.IOExceptionGet 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:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classcom.ibm.mq.headers.internal.Header- See Also:
Object.toString()
-
-