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-
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.String
format()
boolean
getBooleanFieldValue(java.lang.String folder, java.lang.String field)
Get the boolean value of the specified fieldbyte
getByteFieldValue(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 fieldchar
getCharFieldValue(java.lang.String folder, java.lang.String field)
Get the byte value of the specified fieldint
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 fieldint
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 headerfloat
getFloatFieldValue(java.lang.String folder, java.lang.String field)
Get the floating point value of the specified fieldjava.lang.String
getFolderContent(java.lang.String name)
Deprecated.java.lang.String[]
getFolderStrings()
java.lang.String
getFormat()
Get the format name of data that follows NameValueStringint
getIntFieldValue(java.lang.String folder, java.lang.String field)
Get the integer value of the specified fieldlong
getLongFieldValue(java.lang.String folder, java.lang.String field)
Get the long value of the specified fieldint
getNameValueCCSID()
get the coded character set for the NameValue databyte[]
getNameValueData()
get the NameValue dataint
getNameValueLength()
short
getShortFieldValue(java.lang.String folder, java.lang.String field)
Get the short value of the specified fieldjava.lang.String
getStringFieldValue(java.lang.String folder, java.lang.String field)
Get the String value of the specified fieldjava.lang.String
getStrucId()
Get the structure identifier; the value will be MQRFH_STRUC_IDint
getStrucLength()
Get the length of the structure.int
getVersion()
Get the Structure version numberint
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 sourcevoid
setByteFieldValue(java.lang.String folder, java.lang.String field, byte value)
Set the byte value of the specified fieldvoid
setCharFieldValue(java.lang.String folder, java.lang.String field, char value)
Set the short value of the specified fieldvoid
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 fieldvoid
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 fieldvoid
setFieldValues(java.lang.String folder, java.lang.String field, java.util.List values)
set the values of a multi-valued fieldvoid
setFlags(int value)
set the flags on the headervoid
setFloatFieldValue(java.lang.String folder, java.lang.String field, float value)
Set the floating point value of the specified fieldvoid
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 NameValueStringvoid
setIntFieldValue(java.lang.String folder, java.lang.String field, int value)
Set the integer value of the specified fieldvoid
setLongFieldValue(java.lang.String folder, java.lang.String field, long value)
Set the long value of the specified fieldvoid
setNameValueCCSID(int value)
set the coded character set for the NameValue datavoid
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 fieldint
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
-
-
-
-
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 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.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 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, MQDataException
Initialise this Header from the specified data source- Specified by:
read
in interfaceMQData
- Overrides:
read
in 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.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 interfaceMQData
- Overrides:
write
in 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:
nextEncoding
in 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:MQChainable
Sets the numeric encoding of the next header or message content.- Specified by:
nextEncoding
in interfaceMQChainable
- See Also:
MQChainable.nextEncoding(int)
-
nextCharacterSet
public int nextCharacterSet()
- Specified by:
nextCharacterSet
in 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:MQChainable
Sets the CCSID of the next header or message content.- Specified by:
nextCharacterSet
in interfaceMQChainable
- See Also:
MQChainable.nextCharacterSet(int)
-
nextFormat
public java.lang.String nextFormat()
- Specified by:
nextFormat
in 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:MQChainable
Sets the format of the next header or message content.- Specified by:
nextFormat
in interfaceMQChainable
- See Also:
MQChainable.nextFormat(java.lang.String)
-
format
public java.lang.String format()
- Specified by:
format
in 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.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 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.IOException
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:
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 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.IOException
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:
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 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.IOException
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:
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 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.IOException
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:
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 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.IOException
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:
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 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.IOException
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:
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 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.IOException
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:
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 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.IOException
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:
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 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.IOException
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:
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 Headerfield
- the field name in the Header- Returns:
- the String value
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classcom.ibm.mq.headers.internal.Header
- See Also:
Object.toString()
-
-