1 48 49 package org.exolab.jms.message; 50 51 import java.io.IOException ; 52 import java.io.ObjectInput ; 53 import java.io.ObjectOutput ; 54 55 import javax.jms.JMSException ; 56 import javax.jms.MessageNotWriteableException ; 57 import javax.jms.TextMessage ; 58 59 60 67 public final class TextMessageImpl extends MessageImpl implements TextMessage { 68 69 72 static final long serialVersionUID = 1; 73 74 77 private String _text = null; 78 79 84 public TextMessageImpl() throws JMSException { 85 setJMSType("TextMessage"); 86 } 87 88 95 public final Object clone() throws CloneNotSupportedException { 96 return super.clone(); 97 } 98 99 105 public final void writeExternal(ObjectOutput out) throws IOException { 106 super.writeExternal(out); 107 out.writeLong(serialVersionUID); 108 out.writeObject(_text); 109 } 110 111 119 public final void readExternal(ObjectInput in) 120 throws ClassNotFoundException , IOException { 121 super.readExternal(in); 122 long version = in.readLong(); 123 if (version == serialVersionUID) { 124 _text = (String ) in.readObject(); 125 } else { 126 throw new IOException ("Incorrect version enountered: " + version + 127 ". This version = " + serialVersionUID); 128 } 129 } 130 131 137 public final void setText(String string) 138 throws MessageNotWriteableException { 139 checkWrite(); 140 _text = string; 141 } 142 143 149 public final String getText() { 150 return _text; 151 } 152 153 160 public final void clearBody() throws JMSException { 161 super.clearBody(); 162 _text = null; 163 } 164 165 168 public final String toString() { 169 return getText(); 170 } 171 172 } | Popular Tags |