Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.message
Class ActiveMQTextMessage

    java.lang.Object
      org.codehaus.activemq.message.AbstractPacket
          org.codehaus.activemq.message.ActiveMQMessage
              org.codehaus.activemq.message.ActiveMQTextMessage

All Implemented Interfaces:
  Comparable, Message, Packet, TextMessage

public class ActiveMQTextMessage
extends ActiveMQMessage
implements TextMessage

A `TextMessage` object is used to send a message containing a `java.lang.String`. It inherits from the `Message` interface and adds a text message body.

This message type can be used to transport text-based messages, including those with XML content.

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 now be both read from and written to.

See Also:
  `Session.createTextMessage()`, `Session.createTextMessage(String)`, `BytesMessage`, `MapMessage`, `Message`, `ObjectMessage`, `StreamMessage`, `String`

Field Summary

Fields inherited from class org.codehaus.activemq.message.ActiveMQMessage
`BOOLEAN, BROKER_NAME_INDEX, BYTE, BYTES, CHAR, CID_INDEX, CLUSTER_NAME_INDEX, CORRELATION_INDEX, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE, DOUBLE, EOF, EXPIRATION_INDEX, FLOAT, INT, LONG, NULL, PAYLOAD_INDEX, PROPERTIES_INDEX, readOnlyMessage, REDELIVERED_INDEX, REPLY_TO_INDEX, SHORT, STRING, TIMESTAMP_INDEX, TRANSACTION_ID_INDEX, TYPE_INDEX, XA_TRANS_INDEX`

Fields inherited from class org.codehaus.activemq.message.AbstractPacket
`bitArray, BROKERS_VISITED_INDEX, RECEIPT_REQUIRED_INDEX`

Fields inherited from interface javax.jms.Message
`DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE`

Fields inherited from interface org.codehaus.activemq.message.Packet
`ACTIVEMQ_BROKER_INFO, ACTIVEMQ_BYTES_MESSAGE, ACTIVEMQ_CONNECTION_INFO, ACTIVEMQ_MAP_MESSAGE, ACTIVEMQ_MESSAGE, ACTIVEMQ_MSG_ACK, ACTIVEMQ_OBJECT_MESSAGE, ACTIVEMQ_STREAM_MESSAGE, ACTIVEMQ_TEXT_MESSAGE, CAPACITY_INFO, CAPACITY_INFO_REQUEST, CONSUMER_INFO, DURABLE_UNSUBSCRIBE, INT_RESPONSE_RECEIPT_INFO, PRODUCER_INFO, RECEIPT_INFO, RESPONSE_RECEIPT_INFO, SESSION_INFO, TRANSACTION_INFO, WIRE_FORMAT_INFO, XA_TRANSACTION_INFO`

Constructor Summary
`ActiveMQTextMessage()`

Method Summary
`void` | `clearBody()` Clears out the message body.
`ActiveMQMessage` | `deepCopy()`
`int` | `getPacketType()` Return the type of Packet
`String` | `getText()` Gets the string containing this message's data.
`protected void` | `readBody(DataInput dataIn)` Used to help build the body from an input stream
`void` | `setText(String string)` Sets the string containing this message's data.
`ActiveMQMessage` | `shallowCopy()`
`String` | `toString()`
`protected void` | `writeBody(DataOutput dataOut)` Used serialize the message body to an output stream

Methods inherited from class org.codehaus.activemq.message.ActiveMQMessage
`acknowledge, buildBodyFromBytes, clearProperties, compareTo, compareTo, convertBodyToBytes, equals, getBodyAsBytes, getBooleanProperty, getByteProperty, getConsumerId, getConsumerNos, getConsumerNosAsString, getDoubleProperty, getEntryBrokerName, getEntryClusterName, getFloatProperty, getIntProperty, getJMSActiveMQDestination, getJMSClientID, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSMessageIdentity, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getMessageAcknowledge, getObjectProperty, getProducerID, getProperties, getPropertyNames, getShortProperty, getStringProperty, getTransactionId, hashCode, initializeOther, isConsumerTarget, isEntryBroker, isEntryCluster, isExpired, isExpired, isJMSMessage, isMessageConsumed, isPartOfTransaction, isTemporary, isTransientConsumed, isXaTransacted, prepareMessageBody, propertyExists, readMapProperties, setBodyAsBytes, setBooleanProperty, setByteProperty, setConsumerId, setConsumerNos, setDoubleProperty, setEntryBrokerName, setEntryClusterName, setFloatProperty, setIntProperty, setJMSClientID, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSMessageIdentity, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setMessageAcknowledge, setMessageConsumed, setObjectProperty, setProducerID, setProperties, setReadOnly, setShortProperty, setStringProperty, setTransactionId, setTransientConsumed, setXaTransacted, vanillaToBoolean, vanillaToByte, vanillaToDouble, vanillaToFloat, vanillaToInt, vanillaToLong, vanillaToShort, vanillaToString, writeMapProperties`

Methods inherited from class org.codehaus.activemq.message.AbstractPacket
`addBrokerVisited, decrementMemoryReferenceCount, equals, getBitArray, getBrokersVisited, getBrokersVisitedAsString, getId, getMemoryUsage, getMemoryUsageReferenceCount, getPacketTypeAsString, hasVisited, incrementMemoryReferenceCount, initializeBrokersVisited, initializeOther, isReceipt, isReceiptRequired, setBitArray, setId, setMemoryUsage, setReceiptRequired`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, 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`

Constructor Detail

### ActiveMQTextMessage

    public ActiveMQTextMessage()

Method Detail

### toString

    public String toString()

  Overrides:
    `toString` in class `ActiveMQMessage`
  Returns:
    pretty print of this Message

### getPacketType

    public int getPacketType()

  Return the type of Packet

  Specified by:
    `getPacketType` in interface `Packet`
  Overrides:
    `getPacketType` in class `ActiveMQMessage`
  Returns:
    integer representation of the type of Packet

### shallowCopy

    public ActiveMQMessage shallowCopy()
                                throws JMSException

  Overrides:
    `shallowCopy` in class `ActiveMQMessage`
  Returns:
    Returns a shallow copy of the message instance
  Throws:
    `JMSException`

### deepCopy

    public ActiveMQMessage deepCopy()
                             throws JMSException

  Overrides:
    `deepCopy` in class `ActiveMQMessage`
  Returns:
    Returns a deep copy of the message - note the header fields are only shallow copied
  Throws:
    `JMSException`

### clearBody

    public void clearBody()
                   throws JMSException

  Clears out the message body. Clearing a message's body does not clear its header values or property entries.

  If this message body was read-only, calling this method leaves the message body in the same state as an empty body in a newly created message.

  Specified by:
    `clearBody` in interface `Message`
  Overrides:
    `clearBody` in class `ActiveMQMessage`
  Throws:
    `JMSException` - if the JMS provider fails to clear the message body due to some internal error.

### setText

    public void setText(String string)
                 throws JMSException

  Sets the string containing this message's data.

  Specified by:
    `setText` in interface `TextMessage`
  Parameters:
    `string` - the `String` containing the message's data
  Throws:
    `JMSException` - if the JMS provider fails to set the text due to some internal error.
    `MessageNotWriteableException` - if the message is in read-only mode.

### getText

    public String getText()
                   throws JMSException

  Gets the string containing this message's data. The default value is null.

  Specified by:
    `getText` in interface `TextMessage`
  Returns:
    the `String` containing the message's data
  Throws:
    `JMSException`

### writeBody

    protected void writeBody(DataOutput dataOut)
                      throws IOException

  Used serialize the message body to an output stream

  Overrides:
    `writeBody` in class `ActiveMQMessage`
  Parameters:
    `dataOut` -
  Throws:
    `IOException`

### readBody

    protected void readBody(DataInput dataIn)
                     throws IOException

  Used to help build the body from an input stream

  Overrides:
    `readBody` in class `ActiveMQMessage`
  Parameters:
    `dataIn` -
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Protique, Ltd.. All Rights Reserved.