4.2.21. Extensions to the Message Body
- the content of the Body is an arbitrary string, and can be manipulated via the getText and setText methods.
- the content of the Body is a serialized object, and can be manipulated via the getObject and setObject methods.
- the content of the Body is a Map(String, Serialized), and can be manipulated via the setMap and other methods.
- the content of the body is a byte stream that contains arbitrary Java data-types. It can be manipulated using the various setter and getter methods for the data-types. Once created, the BytesMessage should be placed into either a read-only or write-only mode, depending upon how it needs to be manipulated. It is possible to change between these modes (using readMode and writeMode), but each time the mode is changed the buffer pointer will be reset. In order to ensure that all of the updates have been pushed into the body, it is necessary to call flush when finished.
createmethod associated with each of the various body types. An example is
createTextBody. Use this to create and initialize a message of that specific type. Once created, manipulate the message directly by editing the raw body or by using its interface's methods. The body's structure is maintained even after transmission so that it can be manipulated by the message recipient using the methods of the interface that created it.