com.ibm.mq
Class MQMessage

java.lang.Object
  |
  +--com.ibm.mq.MQMD
        |
        +--com.ibm.mq.MQMessage
All Implemented Interfaces:
java.io.DataInput, java.io.DataOutput

public class MQMessage
extends MQMD
implements java.io.DataInput, java.io.DataOutput

MQMessage represents both the message descriptor and the data for a WebSphere MQ message. It has a group of methods for reading data from a message and a group of methods for writing data into a message. The format of numbers and strings used by these read and write methods is controlled by the encoding and characterSet fields. The remaining fields contain control information that accompanies the application message data when a message travels between sending and receiving applications.


Field Summary
 
Fields inherited from class com.ibm.mq.MQMD
accountingToken, applicationIdData, applicationOriginData, backoutCount, characterSet, correlationId, encoding, expiry, feedback, format, groupId, messageFlags, messageId, messageSequenceNumber, messageType, offset, originalLength, persistence, priority, putApplicationName, putApplicationType, putDateTime, replyToQueueManagerName, replyToQueueName, report, userId
 
Constructor Summary
MQMessage()
          The default constructor.
 
Method Summary
 void clearMessage()
          Discards any data in the message buffer and sets the cursor position to zero.
 int getDataLength()
          Gets the number of bytes of message data remaining to be read.
 int getDataOffset()
          Returns the current cursor position within the message data (the point at which read and write operations take effect).
 int getMessageLength()
          Gets the number of bytes of message data in this message.
 int getTotalMessageLength()
          Gets the total number of bytes in the message as stored on the message queue on which this message was held.
 boolean readBoolean()
          Reads a boolean from the current position in the message buffer.
 byte readByte()
          Reads a byte from the current position in the message buffer.
 char readChar()
          Reads a character from the current position in the message buffer.
 short readDecimal2()
          Reads a 2-byte packed decimal number in the range -999 to 999.
 int readDecimal4()
          Reads a 4-byte packed decimal number in the range -9,999,999 to 9,999,999.
 long readDecimal8()
          Reads an 8-byte packed decimal number in the range -999,999,999,999,999 to 999,999,999,999,999.
 double readDouble()
          Reads a double from the current position in the message buffer.
 float readFloat()
          Reads a double from the current position in the message buffer.
 void readFully(byte[] b)
          Fills a byte array with data from the message buffer.
 void readFully(byte[] b, int off, int len)
          Partly fills a byte array with data from the message buffer.
 int readInt()
          Reads an integer from the current position in the message buffer.
 short readInt2()
          Identical to readShort().
 int readInt4()
          Synonym for readInt(), provided for cross-language WMQ API compatibility.
 long readInt8()
          Identical to readLong().
 java.lang.String readLine()
          Reads a line of text from the message.
 long readLong()
          Reads an integer from the current position in the message buffer.
 void readMQMDE()
          Reads an embedded extended MQMD object.
 java.lang.Object readObject()
          Reads an object carried in the message.
 short readShort()
          Reads a short from the current position in the message buffer.
 java.lang.String readString(int length)
          Deprecated. use readStringOfCharLength(int) method instead.
 java.lang.String readStringOfByteLength(int numberOfBytes)
          Reads a specified number of bytes and uses them to construct a new string using the character set specified by characterSet.
 java.lang.String readStringOfCharLength(int numberOfChars)
          Reads a string in the codeset identified by characterSet and converts it into Unicode.
 int readUInt2()
          Identical to readUnsignedShort(), provided for cross-language WMQ API compatibility.
 int readUnsignedByte()
          Reads an unsigned byte from the current position in the message buffer.
 int readUnsignedShort()
          Reads an unsigned short from the current position in the message buffer.
 java.lang.String readUTF()
          Reads a UTF format String from the current position in the message buffer.
 void resizeBuffer(int size)
          Indicates to the MQMessage class the size of buffer that might be required.
 void seek(int offset)
          Moves the cursor to a new absolute position in the message buffer.
 void setDataOffset(int offset)
          Moves the cursor to a new absolute position in the message buffer.
 int skipBytes(int n)
          Moves the cursor forward in the message buffer.
 void write(byte[] b)
          Writes an array of bytes into the message buffer at the current position.
 void write(byte[] b, int off, int len)
          Writes a series of bytes into the message buffer at the current position.
 void write(int b)
          Writes a byte into the message buffer at the current position.
 void writeBoolean(boolean v)
          Writes a boolean into the message buffer at the current position.
 void writeByte(int v)
          Writes a byte into the message buffer at the current position.
 void writeBytes(java.lang.String s)
          Writes a String as a sequence of bytes into the message buffer at the current position.
 void writeChar(int v)
          Writes a Unicode character into the message buffer at the current position.
 void writeChars(java.lang.String s)
          Writes a String as a sequence of Unicode characters into the message buffer at the current position.
 void writeDecimal2(short v)
          Writes a 2-byte packed decimal format number into the message buffer at the current position.
 void writeDecimal4(int v)
          Writes a 4-byte packed decimal format number into the message buffer at the current position.
 void writeDecimal8(long v)
          Writes an 8-byte packed decimal format number into the message buffer at the current position.
 void writeDouble(double v)
          Writes a double into the message buffer at the current position.
 void writeFloat(float v)
          Writes a float into the message buffer at the current position.
 void writeInt(int v)
          Writes an int into the message buffer at the current position.
 void writeInt2(int v)
          Identical to writeShort(), provided for cross-language WMQ API compatibility.
 void writeInt4(int v)
          Synonym for writeInt(), provided for cross-language WMQ API compatibility.
 void writeInt8(long v)
          Synonym for writeLong(), provided for cross-language WMQ API compatibility.
 void writeLong(long v)
          Writes a long into the message buffer at the current position.
 void writeMQMDE()
          Writes an extended MQMD object into the message at the current position.
 void writeObject(java.lang.Object obj)
          Writes an Object into the message.
 void writeShort(int v)
          Writes a short into the message buffer at the current position.
 void writeString(java.lang.String s)
          Writes a String into the message buffer at the current position, converting it to the codeset identified by characterSet.
 void writeUTF(java.lang.String str)
          Writes a String in UTF format into the message buffer at the current position.
 
Methods inherited from class com.ibm.mq.MQMD
getVersion, setVersion
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MQMessage

public MQMessage()
The default constructor. This creates a message with default message descriptor information and an empty message buffer.

Method Detail

getTotalMessageLength

public int getTotalMessageLength()
Gets the total number of bytes in the message as stored on the message queue on which this message was held. This method reports the total size of the message on the queue when an MQQueue.get() method fails with an error code that indicates that the message has been truncated.

Returns:
the total number of bytes in the message

getMessageLength

public int getMessageLength()
                     throws java.io.IOException
Gets the number of bytes of message data in this message.

Returns:
the number of bytes.
Throws:
java.io.IOException - if there is a problem with IO.

getDataLength

public int getDataLength()
                  throws java.io.IOException
Gets the number of bytes of message data remaining to be read.

Returns:
int the number of bytes remaining
Throws:
java.io.IOException - if there is a problem with IO.

seek

public void seek(int offset)
          throws java.io.EOFException
Moves the cursor to a new absolute position in the message buffer. Subsequent reads and writes will start from this position in the buffer.

Parameters:
offset - the new value of the cursor position.
Throws:
java.io.EOFException - if offset takes cursor outside the message data.

setDataOffset

public void setDataOffset(int offset)
                   throws java.io.EOFException
Moves the cursor to a new absolute position in the message buffer. This method is identical to seek(), and is provided for cross-language compatibility with the other WMQ APIs.

Parameters:
offset - the new value of the cursor position.
Throws:
java.io.EOFException - if offset takes cursor outside the message data.

getDataOffset

public int getDataOffset()
                  throws java.io.IOException
Returns the current cursor position within the message data (the point at which read and write operations take effect).

Returns:
the cursor position.
Throws:
java.io.IOException - if there is a problem with IO.

clearMessage

public void clearMessage()
                  throws java.io.IOException
Discards any data in the message buffer and sets the cursor position to zero.

Throws:
java.io.IOException - if there is a problem with IO.

resizeBuffer

public void resizeBuffer(int size)
                  throws java.io.IOException
Indicates to the MQMessage class the size of buffer that might be required. If the message currently contains message data and the new size is less than the current size, the message data is truncated. If this message is subsequently used with MQQueue.get(MQMessage, MQGetMessageOptions), then this is the size of buffer allocated for the get request.

Parameters:
size - the new size of the buffer
Throws:
java.io.IOException - if there is a problem with IO.

readBoolean

public boolean readBoolean()
                    throws java.io.IOException,
                           java.io.EOFException
Reads a boolean from the current position in the message buffer.

Specified by:
readBoolean in interface java.io.DataInput
Returns:
the boolean.
Throws:
java.io.IOException - if there is a problem with IO.
java.io.EOFException - if the read goes beyond the end of file.

readByte

public byte readByte()
              throws java.io.IOException,
                     java.io.EOFException
Reads a byte from the current position in the message buffer.

Specified by:
readByte in interface java.io.DataInput
Returns:
the (signed) byte.
Throws:
java.io.IOException - if there is a problem with IO.
java.io.EOFException - if the read goes beyond the end of file.

readChar

public char readChar()
              throws java.io.IOException,
                     java.io.EOFException
Reads a character from the current position in the message buffer.

Specified by:
readChar in interface java.io.DataInput
Returns:
the Unicode character.
Throws:
java.io.IOException - if there is a problem with IO.
java.io.EOFException - if the read goes beyond the end of file.

readDouble

public double readDouble()
                  throws java.io.IOException,
                         java.io.EOFException
Reads a double from the current position in the message buffer.

Specified by:
readDouble in interface java.io.DataInput
Returns:
a big-endian double if encoding is equal to MQC.MQENC_INTEGER_NORMAL, or a little-endian double if it is equal to MQC.MQENC_INTEGER_REVERSED.
Throws:
java.io.IOException - if encoding is not equal to either of these values.
java.io.EOFException - if the read goes beyond the end of file.

readFloat

public float readFloat()
                throws java.io.IOException,
                       java.io.EOFException
Reads a double from the current position in the message buffer.

Specified by:
readFloat in interface java.io.DataInput
Returns:
a big-endian float if encoding equals MQC.MQENC_INTEGER_NORMAL, a little-endian float if it equals MQC.MQENC_INTEGER_REVERSED, or a zSeries format floating point number if it equals MQC.MQENC_FLOAT_S390.
Throws:
java.io.IOException - if encoding is none of these.
java.io.EOFException - if the read goes beyond the end of file.

readFully

public void readFully(byte[] b)
               throws java.io.IOException
Fills a byte array with data from the message buffer.

Specified by:
readFully in interface java.io.DataInput
Parameters:
b - the byte array.
Throws:
java.io.IOException - if there is a problem with IO.

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException
Partly fills a byte array with data from the message buffer.

Specified by:
readFully in interface java.io.DataInput
Parameters:
b - the byte array.
off - the offset into the message buffer where the reading starts.
len - the number of bytes to be read.
Throws:
java.io.IOException - if there is a problem with IO.

readStringOfByteLength

public java.lang.String readStringOfByteLength(int numberOfBytes)
                                        throws java.io.IOException,
                                               java.io.EOFException
Reads a specified number of bytes and uses them to construct a new string using the character set specified by characterSet. When the given bytes are not valid in the given charset, the behavior of this method is dependant on the implementation of the JRE.

Where the byte length of a string is known, the entire String should be read in a single invocation of this method, thus avoiding problems where byte and char boundaries do not coincide.

Parameters:
numberOfBytes - The number of bytes to read.
Returns:
the string.
Throws:
java.io.IOException - if there is a problem with IO.
java.io.EOFException

readStringOfCharLength

public java.lang.String readStringOfCharLength(int numberOfChars)
                                        throws java.io.IOException,
                                               java.io.EOFException
Reads a string in the codeset identified by characterSet and converts it into Unicode.

Parameters:
numberOfChars - The number of characters to read (which might differ from the number of bytes according to the codeset, because some codesets use more than one byte per character).
Returns:
the string.
Throws:
java.io.IOException - if there is a problem with IO.
java.io.EOFException

readInt

public int readInt()
            throws java.io.IOException
Reads an integer from the current position in the message buffer.

Specified by:
readInt in interface java.io.DataInput
Returns:
a big-endian integer if encoding is equal to MQC.MQENC_INTEGER_NORMAL, or a little-endian integer if it is equal to MQC.MQENC_INTEGER_REVERSED.
Throws:
java.io.IOException - if there is a problem with IO.

readInt4

public int readInt4()
             throws java.io.IOException
Synonym for readInt(), provided for cross-language WMQ API compatibility.

Returns:
int
Throws:
java.io.IOException - if there is a problem with IO.

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Reads a line of text from the message. Converts from the codeset identified in characterSet, and then reads in a line that has been terminated by \n, \r, \r\n, EOF or the end of a UTF string.

Specified by:
readLine in interface java.io.DataInput
Returns:
the returned string, in Unicode.
Throws:
java.io.IOException - if there is a problem with IO.

readLong

public long readLong()
              throws java.io.IOException
Reads an integer from the current position in the message buffer.

Specified by:
readLong in interface java.io.DataInput
Returns:
a big-endian long if encoding is equal to MQC.MQENC_INTEGER_NORMAL, or a little-endian long if it is equal to MQC.MQENC_INTEGER_REVERSED.
Throws:
java.io.IOException - if encoding is not equal to either of these values.

readInt8

public long readInt8()
              throws java.io.IOException
Identical to readLong(). Provided for cross-language WMQ API compatibility.

Returns:
a big-endian long if encoding is equal to MQC.MQENC_INTEGER_NORMAL, or a little-endian long if it is equal to MQC.MQENC_INTEGER_REVERSED.
Throws:
java.io.IOException - if encoding is not equal to either of these values.

readShort

public short readShort()
                throws java.io.IOException
Reads a short from the current position in the message buffer.

Specified by:
readShort in interface java.io.DataInput
Returns:
a big-endian short if encoding is equal to MQC.MQENC_INTEGER_NORMAL, or a little-endian short if it is equal to MQC.MQENC_INTEGER_REVERSED.
Throws:
java.io.IOException - if encoding is not equal to either of these values.

readInt2

public short readInt2()
               throws java.io.IOException
Identical to readShort(). Provided for cross-language MQ API compatibility.

Returns:
a big-endian short if encoding is equal to MQC.MQENC_INTEGER_NORMAL, or a little-endian short if it is equal to MQC.MQENC_INTEGER_REVERSED.
Throws:
java.io.IOException - if there is a problem with IO.

readUTF

public java.lang.String readUTF()
                         throws java.io.IOException
Reads a UTF format String from the current position in the message buffer.

Specified by:
readUTF in interface java.io.DataInput
Returns:
the String.
Throws:
java.io.IOException - if there is a problem with IO.

readUnsignedByte

public int readUnsignedByte()
                     throws java.io.IOException
Reads an unsigned byte from the current position in the message buffer.

Specified by:
readUnsignedByte in interface java.io.DataInput
Returns:
an int that contains the value.
Throws:
java.io.IOException - if there is a problem with IO.

readUnsignedShort

public int readUnsignedShort()
                      throws java.io.IOException
Reads an unsigned short from the current position in the message buffer.

Specified by:
readUnsignedShort in interface java.io.DataInput
Returns:
an int that contains a big-endian short if encoding is equal to MQC.MQENC_INTEGER_NORMAL, or a little-endian short if it is equal to MQC.MQENC_INTEGER_REVERSED.
Throws:
java.io.IOException - if encoding is not equal to either of these values.

readUInt2

public int readUInt2()
              throws java.io.IOException
Identical to readUnsignedShort(), provided for cross-language WMQ API compatibility.

Returns:
an int that contains a big-endian short if encoding is equal to MQC.MQENC_INTEGER_NORMAL, or a little-endian short if it is equal to MQC.MQENC_INTEGER_REVERSED.
Throws:
java.io.IOException - if there is a problem with IO.

readString

public java.lang.String readString(int length)
                            throws java.io.IOException
Deprecated. use readStringOfCharLength(int) method instead.

Reads a string in the codeset identified by characterSet and converts it into Unicode.

Parameters:
length - The number of characters to read (which might differ from the number of bytes according to the codeset, since some codesets use more than one byte per character).
Returns:
a String in the appropriate codeset
Throws:
java.io.IOException

readDecimal2

public short readDecimal2()
                   throws java.io.IOException
Reads a 2-byte packed decimal number in the range -999 to 999.

Returns:
a big-endian short if encoding equals MQC.MQENC_DECIMAL_NORMAL or a little-endian short if it equals MQC.MQENC_DECIMAL_REVERSED.
Throws:
java.io.IOException - if there is a problem with IO.

readDecimal4

public int readDecimal4()
                 throws java.io.IOException
Reads a 4-byte packed decimal number in the range -9,999,999 to 9,999,999.

Returns:
a big-endian int if encoding equals MQC.MQENC_DECIMAL_NORMAL or a little-endian int if it equals MQC.MQENC_DECIMAL_REVERSED.
Throws:
java.io.IOException - if there is a problem with IO.

readDecimal8

public long readDecimal8()
                  throws java.io.IOException
Reads an 8-byte packed decimal number in the range -999,999,999,999,999 to 999,999,999,999,999.

Returns:
a big-endian long if encoding equals MQC.MQENC_DECIMAL_NORMAL or a little-endian long if it equals MQC.MQENC_DECIMAL_REVERSED.
Throws:
java.io.IOException - if there is a problem with IO.

readMQMDE

public void readMQMDE()
               throws MQException,
                      java.io.IOException
Reads an embedded extended MQMD object. It uses extended MQMD information to update encoding, characterSet, format, groupId, messageSequenceNumber, offset, messageFlags and originalLength fields. You should only call this method if format is MQC.MQFMT_MD_EXTENSION.

Throws:
java.io.IOException - if there is a problem with IO.
java.io.EOFException - if the read goes beyond the end of file.
MQException

readObject

public java.lang.Object readObject()
                            throws java.lang.ClassNotFoundException,
                                   java.io.InvalidClassException,
                                   java.io.StreamCorruptedException,
                                   java.io.OptionalDataException,
                                   java.io.IOException
Reads an object carried in the message.

Returns:
the Object.
Throws:
java.lang.ClassNotFoundException
java.io.InvalidClassException
java.io.StreamCorruptedException
java.io.OptionalDataException
java.io.IOException

skipBytes

public int skipBytes(int n)
              throws java.io.IOException,
                     java.io.EOFException
Moves the cursor forward in the message buffer.

Specified by:
skipBytes in interface java.io.DataInput
Parameters:
n - the number of bytes to move.
Returns:
the number of bytes actually moved.
Throws:
java.io.IOException - if there is a problem with IO.
java.io.EOFException - if the skip goes beyond the end of file.

write

public void write(int b)
           throws java.io.IOException
Writes a byte into the message buffer at the current position.

Specified by:
write in interface java.io.DataOutput
Parameters:
b - the byte to be written
Throws:
java.io.IOException - if there is a problem with IO.

write

public void write(byte[] b)
           throws java.io.IOException
Writes an array of bytes into the message buffer at the current position.

Specified by:
write in interface java.io.DataOutput
Parameters:
b - the array to be written.
Returns:
the array to be written.
Throws:
java.io.IOException - if there is a problem with IO.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes a series of bytes into the message buffer at the current position.

Specified by:
write in interface java.io.DataOutput
Parameters:
b - the array from which the bytes are written.
off - the offset to the first byte in the array to be written.
len - the number of bytes to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeBoolean

public void writeBoolean(boolean v)
                  throws java.io.IOException
Writes a boolean into the message buffer at the current position.

Specified by:
writeBoolean in interface java.io.DataOutput
Parameters:
v - the boolean to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeByte

public void writeByte(int v)
               throws java.io.IOException
Writes a byte into the message buffer at the current position.

Specified by:
writeByte in interface java.io.DataOutput
Parameters:
v - the byte to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeBytes

public void writeBytes(java.lang.String s)
                throws java.io.IOException
Writes a String as a sequence of bytes into the message buffer at the current position.

Specified by:
writeBytes in interface java.io.DataOutput
Parameters:
s - the String to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeChar

public void writeChar(int v)
               throws java.io.IOException
Writes a Unicode character into the message buffer at the current position.

Specified by:
writeChar in interface java.io.DataOutput
Parameters:
v - the character to be written, expressed as an int.
Throws:
java.io.IOException - if there is a problem with IO.

writeChars

public void writeChars(java.lang.String s)
                throws java.io.IOException
Writes a String as a sequence of Unicode characters into the message buffer at the current position.

Specified by:
writeChars in interface java.io.DataOutput
Parameters:
s - the String to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeDouble

public void writeDouble(double v)
                 throws java.io.IOException
Writes a double into the message buffer at the current position. The behavior of this method is determined by encoding.

Values of MQC.MQENC_FLOAT_IEEE_NORMAL and MQENC_IEEE_FLOAT_REVERSED write IEEE standard floats in big-endian and little-endian formats respectively.

A value of MQC.MQENC_FLOAT_S390 writes a zSeries format floating point number. Note that the range of IEEE doubles is greater than the range of zSeries double precision floating point numbers, and that very large numbers cannot be converted.

Specified by:
writeDouble in interface java.io.DataOutput
Parameters:
v - the double to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeFloat

public void writeFloat(float v)
                throws java.io.IOException
Writes a float into the message buffer at the current position. The behavior of this method is determined by encoding.

Values of MQC.MQENC_FLOAT_IEEE_NORMAL and MQENC_IEEE_FLOAT_REVERSED write IEEE standard floats in big-endian and little-endian formats respectively.

A value of MQC.MQENC_FLOAT_S390 writes a zSeries format floating point number. Note that the range of IEEE doubles is greater than the range of zSeries double precision floating point numbers, and that very large numbers cannot be converted.

Specified by:
writeFloat in interface java.io.DataOutput
Parameters:
v - the float to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeInt

public void writeInt(int v)
              throws java.io.IOException
Writes an int into the message buffer at the current position. The behavior of this method is determined by encoding.

Values of MQC.MQENC_INTEGER_NORMAL and MQC.MQENC_INTEGER_REVERSED write integers in big-endian and little-endian formats respectively.

Specified by:
writeInt in interface java.io.DataOutput
Parameters:
v - the int to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeInt4

public void writeInt4(int v)
               throws java.io.IOException
Synonym for writeInt(), provided for cross-language WMQ API compatibility.

Parameters:
v - the int to be written
Throws:
java.io.IOException - if there is a problem with IO.

writeLong

public void writeLong(long v)
               throws java.io.IOException
Writes a long into the message buffer at the current position. The behavior of this method is determined by encoding.

Values of MQC.MQENC_INTEGER_NORMAL and MQC.MQENC_INTEGER_REVERSED write longs in big-endian and little-endian formats respectively.

Specified by:
writeLong in interface java.io.DataOutput
Parameters:
v - the long to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeInt8

public void writeInt8(long v)
               throws java.io.IOException
Synonym for writeLong(), provided for cross-language WMQ API compatibility.

Parameters:
v - the long to be written
Throws:
java.io.IOException - if there is a problem with IO.

writeShort

public void writeShort(int v)
                throws java.io.IOException
Writes a short into the message buffer at the current position. The behavior of this method is determined by encoding.

Values of MQC.MQENC_INTEGER_NORMAL and MQC.MQENC_INTEGER_REVERSED write shorts in big-endian and little-endian formats respectively.

A value of MQC.MQENC_FLOAT_S390 writes a zSeries format floating point number.

Specified by:
writeShort in interface java.io.DataOutput
Parameters:
v - the long to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeInt2

public void writeInt2(int v)
               throws java.io.IOException
Identical to writeShort(), provided for cross-language WMQ API compatibility.

Parameters:
v - the long to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeDecimal2

public void writeDecimal2(short v)
                   throws java.io.IOException
Writes a 2-byte packed decimal format number into the message buffer at the current position. The behavior of this method is determined by encoding. A value of MQC.MQENC_DECIMAL_NORMAL writes a big-endian packed decimal and a value of MQC.MQENC_DECIMAL_REVERSED writes a little-endian packed decimal.

Parameters:
v - is the number to be written in the range -999 to 999.
Throws:
java.io.IOException - if there is a problem with IO.

writeDecimal4

public void writeDecimal4(int v)
                   throws java.io.IOException
Writes a 4-byte packed decimal format number into the message buffer at the current position. The behavior of this method is determined by encoding. A value of MQC.MQENC_DECIMAL_NORMAL writes a big-endian packed decimal and a value of MQC.MQENC_DECIMAL_REVERSED writes a little-endian packed decimal.

Parameters:
v - is the number to be written in the range -9,999,999 to 9,999,999.
Throws:
java.io.IOException - if there is a problem with IO.

writeDecimal8

public void writeDecimal8(long v)
                   throws java.io.IOException
Writes an 8-byte packed decimal format number into the message buffer at the current position. The behavior of this method is determined by encoding. A value of MQC.MQENC_DECIMAL_NORMAL writes a big-endian packed decimal and a value of MQC.MQENC_DECIMAL_REVERSED writes a little-endian packed decimal.

Parameters:
v - is the number to be written int the range -999,999,999,999,999 to 999,999,999,999,999.
Throws:
java.io.IOException - if there is a problem with IO.

writeUTF

public void writeUTF(java.lang.String str)
              throws java.io.IOException
Writes a String in UTF format into the message buffer at the current position.

Specified by:
writeUTF in interface java.io.DataOutput
Parameters:
str - the String to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeString

public void writeString(java.lang.String s)
                 throws java.io.IOException
Writes a String into the message buffer at the current position, converting it to the codeset identified by characterSet.

Parameters:
s - the String to be written.
Throws:
java.io.IOException - if there is a problem with IO.

writeMQMDE

public void writeMQMDE()
                throws java.io.IOException,
                       MQException
Writes an extended MQMD object into the message at the current position. Values for the MQMDE are drawn from the field values: encoding, characterSet, format, groupId, messageSequenceNumber, offset, messageFlags and originalLength fields. The current value of the format field is written into the MDE, and the format field is then set to MQFMT_MD_EXTENSION.

Throws:
java.io.IOException - if there is a problem with IO.
java.io.EOFException - if the read goes beyond the end of file.
MQException

writeObject

public void writeObject(java.lang.Object obj)
                 throws java.io.IOException
Writes an Object into the message.

Parameters:
obj - the Object to be written.
Throws:
java.io.IOException - if there is a problem with IO.

(c) Copyright IBM Corp. 2005. All Rights Reserved.