com.ibm.mq.headers

Class MQRFH2

  1. java.lang.Object
  2. extended bycom.ibm.mq.jmqi.JmqiObject
  3. extended bycom.ibm.mq.headers.internal.Header
  4. extended bycom.ibm.mq.headers.MQRFH2
All implemented interfaces:
MQChainable, MQData, MQHeader

  1. public class MQRFH2
  2. extends com.ibm.mq.headers.internal.Header
  3. 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/interfaces inherited from interface com.ibm.mq.headers.MQHeader
MQHeader.Field

Field Summary

Fields inherited from class com.ibm.mq.headers.internal.Header
DEFAULT_CCSID, DEFAULT_ENCODING, sccsid
Fields inherited from class com.ibm.mq.jmqi.JmqiObject
COMP_JM, COMP_JN, COMP_JO

Constructor Summary

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

Modifier and Type Method and Description
  1. java.lang.String
format()
  1. boolean
getBooleanFieldValue(java.lang.String folder,java.lang.String field)
Get the boolean value of the specified field
  1. byte
getByteFieldValue(java.lang.String folder,java.lang.String field)
Get the byte value of the specified field
  1. byte[]
getBytesFieldValue(java.lang.String folder,java.lang.String field)
Get the byte array value of the specified field
  1. char
getCharFieldValue(java.lang.String folder,java.lang.String field)
Get the byte value of the specified field
  1. int
getCodedCharSetId()
Get the Character set identifier of data that follows.
  1. double
getDoubleFieldValue(java.lang.String folder,java.lang.String field)
Get the double precision floating point value of the specified field
  1. int
getEncoding()
Get the numeric encoding of the data that follows.
  1. java.lang.Object
getFieldValue(java.lang.String folder,java.lang.String 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.
  1. java.lang.Object
getFieldValue(java.lang.String folder,java.lang.String field,int occurrence)
Returns the contents of the nth field with the specified name from within a folder string, or null if no such field is present.
  1. java.util.List
getFieldValues(java.lang.String folder,java.lang.String field)
Returns a list containing all occurrences of field values matching the specified field name in the folder.
  1. int
getFlags()
get the flags from the header
  1. float
getFloatFieldValue(java.lang.String folder,java.lang.String field)
Get the floating point value of the specified field
  1. java.lang.String
getFolderContent(java.lang.String name)
Deprecated.
  1. java.lang.String[]
getFolderStrings()
Returns the contents of the variable part of the structure as an array of Strings.
  1. java.lang.String
getFormat()
Get the format name of data that follows NameValueString
  1. int
getIntFieldValue(java.lang.String folder,java.lang.String field)
Get the integer value of the specified field
  1. long
getLongFieldValue(java.lang.String folder,java.lang.String field)
Get the long value of the specified field
  1. int
getNameValueCCSID()
get the coded character set for the NameValue data
  1. byte[]
getNameValueData()
get the NameValue data
  1. int
getNameValueLength()
Returns the NameValueLength field value.
  1. short
getShortFieldValue(java.lang.String folder,java.lang.String field)
Get the short value of the specified field
  1. java.lang.String
getStringFieldValue(java.lang.String folder,java.lang.String field)
Get the String value of the specified field
  1. java.lang.String
getStrucId()
Get the structure identifier; the value will be MQRFH_STRUC_ID
  1. int
getStrucLength()
Get the length of the structure.
  1. int
getVersion()
Get the Structure version number
  1. int
nextCharacterSet()
  1. void
nextCharacterSet(int value)
  1. int
nextEncoding()
  1. void
nextEncoding(int value)
  1. java.lang.String
nextFormat()
  1. void
nextFormat(java.lang.String value)
  1. int
read(java.io.DataInput input,int encoding,int characterSet)
Initialise this Header from the specified data source
  1. void
setByteFieldValue(java.lang.String folder,java.lang.String field,byte value)
Set the byte value of the specified field
  1. void
setCharFieldValue(java.lang.String folder,java.lang.String field,char value)
Set the short value of the specified field
  1. void
setCodedCharSetId(int value)
Set the Character set identifier of data that follows.
  1. void
setDoubleFieldValue(java.lang.String folder,java.lang.String field,double value)
Set the double precision floating point value of the specified field
  1. void
setEncoding(int value)
Set the numeric encoding of the data that follows.
  1. void
setFieldValue(java.lang.String folder,java.lang.String field,java.lang.Object value)
set value of a field
  1. void
setFieldValues(java.lang.String folder,java.lang.String field,java.util.List values)
set the values of a multi-valued field
  1. void
setFlags(int value)
set the flags on the header
  1. void
setFloatFieldValue(java.lang.String folder,java.lang.String field,float value)
Set the floating point value of the specified field
  1. void
setFolderContent(java.lang.String name,java.lang.String content)
Deprecated.
  1. void
setFolderStrings(java.lang.String[] folders)
Replaces content of the variable part of the MQRFH2 structure with the specified array of strings.
  1. void
setFormat(java.lang.String value)
Set the format name of data that follows NameValueString
  1. void
setIntFieldValue(java.lang.String folder,java.lang.String field,int value)
Set the integer value of the specified field
  1. void
setLongFieldValue(java.lang.String folder,java.lang.String field,long value)
Set the long value of the specified field
  1. void
setNameValueCCSID(int value)
set the coded character set for the NameValue data
  1. void
setNameValueData(byte[] value)
Sets the NameValueData field.
  1. void
setNameValueData(java.lang.String value)
Sets the NameValueData field.
  1. void
setShortFieldValue(java.lang.String folder,java.lang.String field,short value)
Set the short value of the specified field
  1. int
size()
Get the size of this header
  1. java.lang.String
toString()
  1. int
write(java.io.DataOutput output,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

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

MQRFH2

  1. public MQRFH2(java.io.DataInput message)
  2. throws MQDataException
  3. 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

  1. public MQRFH2(java.io.DataInput message,
  2. int encoding,
  3. int characterSet)
  4. throws MQDataException
  5. 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

  1. public int read(java.io.DataInput input,
  2. int encoding,
  3. int characterSet)
  4. throws java.io.IOException
  5. 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

write

  1. public int write(java.io.DataOutput output,
  2. int encoding,
  3. int characterSet)
  4. 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:
output - 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

  1. public int size()
Get the size of this header
Specified by:
size in interface MQData
Overrides:
size in class com.ibm.mq.headers.internal.Header

nextEncoding

  1. public int nextEncoding()
Description copied from interface: MQChainable
Returns the numeric encoding of the next header or message content.
Specified by:
nextEncoding in interface MQChainable

nextEncoding

  1. 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 interface MQChainable

nextCharacterSet

  1. public int nextCharacterSet()
Description copied from interface: MQChainable
Returns the CCSID of the next header or message content.
Specified by:

nextCharacterSet

  1. public void nextCharacterSet(int value)
Description copied from interface: MQChainable
Sets the CCSID of the next header or message content.
Specified by:

nextFormat

  1. public java.lang.String nextFormat( )
Description copied from interface: MQChainable
Returns the format of the next header or message content.
Specified by:
nextFormat in interface MQChainable

nextFormat

  1. 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 interface MQChainable

format

  1. public java.lang.String format( )
Description copied from interface: MQChainable
Returns the format associated with this header object or message content.
Specified by:
format in interface MQChainable

getStrucId

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

getVersion

  1. public int getVersion()
Get the Structure version number
Returns:
the Structure version number

getStrucLength

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

getEncoding

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

setEncoding

  1. 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

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

setCodedCharSetId

  1. 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

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

setFormat

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

getFlags

  1. public int getFlags()
get the flags from the header
Returns:
the flags

setFlags

  1. public void setFlags(int value)
set the flags on the header
Parameters:
value - the flags

getNameValueCCSID

  1. public int getNameValueCCSID()
get the coded character set for the NameValue data
Returns:
the NameValue data

setNameValueCCSID

  1. 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

  1. 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

  1. public byte[] getNameValueData( )
get the NameValue data
Returns:
the NameValue data

setNameValueData

  1. 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.

setNameValueData

  1. public void setNameValueData(java.lang.String value)
  2. 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.
Throws:
java.io.IOException

getFolderStrings

  1. public java.lang.String[] getFolderStrings( )
  2. 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

  1. public void setFolderStrings(java.lang.String[] folders)
  2. 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.
Throws:
java.io.IOException

getFolderContent

  1. @Deprecated
  2. public java.lang.String getFolderContent( java.lang.String name)
  3. throws java.io.IOException
Deprecated.
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

  1. public void setFolderContent(java.lang.String name,
  2. java.lang.String content)
  3. 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.
Throws:
java.io.IOException

getFieldValue

  1. public java.lang.Object getFieldValue( java.lang.String folder,
  2. java.lang.String tag)
  3. throws java.io.IOException
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

  1. public java.lang.Object getFieldValue( java.lang.String folder,
  2. java.lang.String field,
  3. int occurrence)
  4. throws java.io.IOException
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

  1. public java.util.List getFieldValues( java.lang.String folder,
  2. java.lang.String field)
  3. throws java.io.IOException
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

  1. public void setFieldValue(java.lang.String folder,
  2. java.lang.String field,
  3. java.lang.Object value)
  4. 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

  1. public void setFieldValues(java.lang.String folder,
  2. java.lang.String field,
  3. java.util.List values)
  4. 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

  1. public boolean getBooleanFieldValue( java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public int getIntFieldValue(java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public void setIntFieldValue(java.lang.String folder,
  2. java.lang.String field,
  3. int value)
  4. 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

  1. public byte getByteFieldValue(java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public void setByteFieldValue(java.lang.String folder,
  2. java.lang.String field,
  3. byte value)
  4. 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

  1. public short getShortFieldValue( java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public void setShortFieldValue( java.lang.String folder,
  2. java.lang.String field,
  3. short value)
  4. 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

  1. public char getCharFieldValue(java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public void setCharFieldValue(java.lang.String folder,
  2. java.lang.String field,
  3. char value)
  4. 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

  1. public long getLongFieldValue(java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public void setLongFieldValue(java.lang.String folder,
  2. java.lang.String field,
  3. long value)
  4. 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

  1. public float getFloatFieldValue( java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public void setFloatFieldValue( java.lang.String folder,
  2. java.lang.String field,
  3. float value)
  4. 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

  1. public double getDoubleFieldValue( java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public void setDoubleFieldValue( java.lang.String folder,
  2. java.lang.String field,
  3. double value)
  4. 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

  1. public byte[] getBytesFieldValue( java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public java.lang.String getStringFieldValue( java.lang.String folder,
  2. java.lang.String field)
  3. 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

  1. public java.lang.String toString( )
Overrides:
toString in class com.ibm.mq.headers.internal.Header
See Also:
Object.toString()