Oracle GlassFish Message Queue 4.4.2 Developer's Guide for Java Clients

Processing Stream Messages

Reading the contents of a stream message is similar to reading from a data stream, using the access methods shown in Table 2–21: for example, the statement

int  intVal = inMsg.readInt();

retrieves an integer value from the message stream.

Table 2–21 Stream Message Access Methods

Name 

Description 

readInt

Read integer from message stream 

readByte

Read byte value from message stream 

readBytes

Read byte array from message stream 

readShort

Read short integer from message stream 

readLong

Read long integer from message stream 

readFloat

Read floating-point value from message stream 

readDouble

Read double-precision value from message stream 

readBoolean

Read boolean value from message stream 

readChar

Read character from message stream 

readString

Read string from message stream 

readObject

Read value from message stream as object 

The readObject method returns the next value from the message stream in objectified form, as a Java object of the class corresponding to the value’s primitive data type: for instance, if the value is of type int, readObject returns an object of class Integer. The following statements are equivalent to the one shown above:

Integer  intObject = (Integer) inMsg.readObject();
int      intVal    = intObject.intValue();