1 22 package org.jboss.mq.il.uil2.msgs; 23 24 import java.io.ObjectOutputStream ; 25 import java.io.IOException ; 26 import java.io.ObjectInputStream ; 27 import org.jboss.mq.SpyMessage; 28 29 33 public class AddMsg extends BaseMsg 34 { 35 private SpyMessage msg; 36 37 public AddMsg() 38 { 39 this(null); 40 } 41 public AddMsg(SpyMessage msg) 42 { 43 super(MsgTypes.m_addMessage); 44 this.msg = msg; 45 } 46 47 public SpyMessage getMsg() 48 { 49 return msg; 50 } 51 52 public void trimReply() 53 { 54 msg = null; 55 } 56 57 public void write(ObjectOutputStream out) throws IOException 58 { 59 super.write(out); 60 int hasMessage = msg != null ? 1 : 0; 61 out.writeByte(hasMessage); 62 if (hasMessage == 1) 63 SpyMessage.writeMessage(msg, out); 64 } 65 66 public void read(ObjectInputStream in) throws IOException , ClassNotFoundException 67 { 68 super.read(in); 69 int hasMessage = in.readByte(); 70 if (hasMessage == 1) 71 msg = SpyMessage.readMessage(in); 72 } 73 74 } 75 | Popular Tags |