01: /*
02: * @(#)TextMessage.java 1.17 02/04/09
03: *
04: * Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * SUN PROPRIETARY/CONFIDENTIAL.
07: * This software is the proprietary information of Sun Microsystems, Inc.
08: * Use is subject to license terms.
09: *
10: */
11:
12: package javax.jms;
13:
14: /** A <CODE>TextMessage</CODE> object is used to send a message containing a
15: * <CODE>java.lang.String</CODE>.
16: * It inherits from the <CODE>Message</CODE> interface and adds a text message
17: * body.
18: *
19: * <P>This message type can be used to transport text-based messages, including
20: * those with XML content.
21: *
22: * <P>When a client receives a <CODE>TextMessage</CODE>, it is in read-only
23: * mode. If a client attempts to write to the message at this point, a
24: * <CODE>MessageNotWriteableException</CODE> is thrown. If
25: * <CODE>clearBody</CODE> is
26: * called, the message can now be both read from and written to.
27: *
28: * @version 1.1 - February 2, 2002
29: * @author Mark Hapner
30: * @author Rich Burridge
31: * @author Kate Stout
32: *
33: * @see javax.jms.Session#createTextMessage()
34: * @see javax.jms.Session#createTextMessage(String)
35: * @see javax.jms.BytesMessage
36: * @see javax.jms.MapMessage
37: * @see javax.jms.Message
38: * @see javax.jms.ObjectMessage
39: * @see javax.jms.StreamMessage
40: * @see java.lang.String
41: */
42:
43: public interface TextMessage extends Message {
44:
45: /** Sets the string containing this message's data.
46: *
47: * @param string the <CODE>String</CODE> containing the message's data
48: *
49: * @exception JMSException if the JMS provider fails to set the text due to
50: * some internal error.
51: * @exception MessageNotWriteableException if the message is in read-only
52: * mode.
53: */
54:
55: void setText(String string) throws JMSException;
56:
57: /** Gets the string containing this message's data. The default
58: * value is null.
59: *
60: * @return the <CODE>String</CODE> containing the message's data
61: *
62: * @exception JMSException if the JMS provider fails to get the text due to
63: * some internal error.
64: */
65:
66: String getText() throws JMSException;
67: }
|