java.lang.Object | +----com.ibm.mq.MQMD | +----com.ibm.mq.MQMessage
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 which accompanies the application message data when a message travels between sending and receiving applications.
public MQMessage();
The default constructor. This creates a message with default message descriptor information and an empty message buffer.
public void clearMessage() throws IOException;
Discards any data in the message buffer and sets the cursor position to zero.
public int getDataLength() throws IOException;
Gets the number of bytes of message data remaining to be read.
public int getDataOffset() throws IOException;
Returns the current cursor position within the message data (the point at which read and write operations take effect).
public int getMessageLength() throws IOException;
Gets the number of bytes of message data in this message.
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 which indicates that the message has been truncated.
public boolean readBoolean() throws IOException, EOFException;
Reads a boolean from the current position in the message buffer.
public byte readByte() throws IOException, EOFException;
Reads a byte from the current position in the message buffer.
public char readChar() throws IOException, EOFException;
Reads a character from the current position in the message buffer.
public short readDecimal2() throws IOException;
Reads a 2-byte packed decimal number in the range -999 to 999.
public int readDecimal4() throws IOException;
Reads a 4-byte packed decimal number in the range -9,999,999 to 9,999,999.
public long readDecimal8() throws IOException;
Reads an 8-byte packed decimal number in the range -999,999,999,999,999 to 999,999,999,999,999.
public double readDouble() throws IOException, EOFException;
Reads a double from the current position in the message buffer.
public float readFloat() throws IOException, EOFException;
Reads a double from the current position in the message buffer.
public void readFully(byte[] b) throws IOException;
Fills a byte array with data from the message buffer.
public void readFully(byte[] b, int off, int len) throws IOException;
Partly fills a byte array with data from the message buffer.
public int readInt() throws IOException;
Reads an integer from the current position in the message buffer.
public short readInt2() throws IOException;
Identical to readShort(). Provided for cross-language WebSphere MQ API compatibility.
public int readInt4() throws IOException;
Synonym for readInt(), provided for cross-language WebSphere MQ API compatibility.
public long readInt8() throws IOException;
Identical to readLong(). Provided for cross-language WebSphere MQ API compatibility.
public String readLine() throws 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.
public long readLong() throws IOException;
Reads an integer from the current position in the message buffer.
public void readMQMDE() throws MQException, IOException;
Reads an imbedded extended MQMD object. It uses extended MQMD information to update encoding, characterSet, format, groupId, messageSequenceNumber , offset, messageFlags and originalLength fields. Only call this method if format is MQC.MQFMT_MD_EXTENSION .
public Object readObject() throws ClassNotFoundException, InvalidClassException, StreamCorruptedException, OptionalDataException, IOException;
Reads an object carried in the message.
public short readShort() throws IOException;
Reads a short from the current position in the message buffer.
public String readString(int length) throws IOException;
Reads a string in the codeset identified by characterSet and converts it into Unicode.
public String readStringOfByteLength(int numberOfBytes) throws IOException, 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, read the entire String in a single invocation of this method. This will avoid problems where byte and char boundaries do not coincide.
public String readStringOfCharLength(int numberOfChars) throws IOException, EOFException;
Reads a string in the codeset identified by characterSet and converts it into Unicode.
public int readUInt2() throws IOException;
Identical to readUnsignedShort(), provided for cross-language WebSphere MQ API compatibility.
public int readUnsignedByte() throws IOException;
Reads an unsigned byte from the current position in the message buffer.
public int readUnsignedShort() throws IOException;
Reads an unsigned short from the current position in the message buffer.
public String readUTF() throws IOException;
Reads a UTF format String from the current position in the message buffer.
public void resizeBuffer(int size) throws 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(), then this is the size of buffer allocated for the get request.
public void seek(int offset) throws 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.
public void setDataOffset(int offset) throws 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 WebSphere MQ APIs.
public int skipBytes(int n) throws IOException, EOFException;
Moves the cursor forward in the message buffer.
public void write(byte[] b) throws IOException;
Writes an array of bytes into the message buffer at the current position.
public void write(byte[] b, int off, int len) throws IOException;
Writes a series of bytes into the message buffer at the current position.
public void write(int b) throws IOException;
Writes a byte into the message buffer at the current position.
public void writeBoolean(boolean v) throws IOException;
Writes a boolean into the message buffer at the current position.
public void writeByte(int v) throws IOException;
Writes a byte into the message buffer at the current position.
public void writeBytes(String s) throws IOException;
Writes a String as a sequence of bytes into the message buffer at the current position.
public void writeChar(int v) throws IOException;
Writes a Unicode character into the message buffer at the current position.
public void writeChars(String s) throws IOException;
Writes a String as a sequence of Unicode characters into the message buffer at the current position.
public void writeDecimal2(short v) throws 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.
public void writeDecimal4(int v) throws 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.
public void writeDecimal8(long v) throws 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.
public void writeDouble(double v) throws 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.
public void writeFloat(float v) throws 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.
public void writeInt(int v) throws 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.
public void writeInt2(int v) throws IOException;
Identical to writeShort(), provided for cross-language WebSphere MQ API compatibility.
public void writeInt4(int v) throws IOException;
Synonym for writeInt(), provided for cross-language WebSphere MQ API compatibility.
public void writeInt8(long v) throws IOException;
Synonym for writeLong(), provided for cross-language WebSphere MQ API compatibility.
public void writeLong(long v) throws 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.
public void writeMQMDE() throws 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.
public void writeObject(Object obj) throws IOException;
Writes an Object into the message.
public void writeShort(int v) throws 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.
public void writeString(String s) throws IOException;
Writes a String into the message buffer at the current position, converting it to the codeset identified by characterSet.
public void writeUTF(String str) throws IOException;
Writes a String in UTF format into the message buffer at the current position.
Notices |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
csq770d |