com.ibm.jms
Class JMSTextMessage

java.lang.Object
  |
  +--com.ibm.jms.JMSMessage
        |
        +--com.ibm.jms.JMSTextMessage
All Implemented Interfaces:
javax.jms.Message, java.io.Serializable, javax.jms.TextMessage

public class JMSTextMessage
extends JMSMessage
implements javax.jms.TextMessage

A TextMessage is used to send a message containing a java.lang.String. It inherits from JMSMessage and adds a text body.

When a client receives a TextMessage, it is in read-only mode. If a client attempts to write to the message at this point, a MessageNotWriteableException is thrown. If clearBody() is called, the message can then be both read from and written to.

See Also:
Serialized Form

Field Summary
   
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Method Summary
 void clearBody()
          Clears out the message body.
 java.lang.String getText()
          Gets the String containing this message's data.
 void setText(java.lang.String messageText)
          Sets the String containing this message's data.
 java.lang.String toString()
          Returns a String containing a formatted version of the Message.
 
Methods inherited from class com.ibm.jms.JMSMessage
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jms.Message
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 

Method Detail

clearBody

public void clearBody()
               throws javax.jms.JMSException
Clears out the message body. No other part of the message is changed.

Specified by:
clearBody in interface javax.jms.Message
Specified by:
clearBody in class JMSMessage
Throws:
javax.jms.JMSException - if an internal error occurs

getText

public java.lang.String getText()
                         throws javax.jms.JMSException
Gets the String containing this message's data. The default value is null.

Specified by:
getText in interface javax.jms.TextMessage
Returns:
the message data in String form.
Throws:
javax.jms.JMSException - IllegalStateException with reason MQJMS_E_BAD_CCSID.

setText

public void setText(java.lang.String messageText)
             throws javax.jms.JMSException
Sets the String containing this message's data.

Specified by:
setText in interface javax.jms.TextMessage
Parameters:
messageText - the String containing the message's data
Throws:
javax.jms.JMSException - if an internal error occurs.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.

toString

public java.lang.String toString()
Returns a String containing a formatted version of the Message.

Overrides:
toString in class JMSMessage
Returns:
the message formatted as a String.

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