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 javax.jms.Destination ; 28 import org.jboss.mq.SpyMessage; 29 30 34 public class BrowseMsg extends BaseMsg 35 { 36 private Destination dest; 37 private String selector; 38 private SpyMessage[] msgs; 39 40 public BrowseMsg() 41 { 42 this(null, null); 43 } 44 public BrowseMsg(Destination dest, String selector) 45 { 46 super(MsgTypes.m_browse); 47 this.dest = dest; 48 this.selector = selector; 49 } 50 51 public Destination getDest() 52 { 53 return dest; 54 } 55 public String getSelector() 56 { 57 return selector; 58 } 59 public void setMessages(SpyMessage[] msgs) 60 { 61 this.msgs = msgs; 62 } 63 public SpyMessage[] getMessages() 64 { 65 return msgs; 66 } 67 68 public void write(ObjectOutputStream out) throws IOException 69 { 70 super.write(out); 71 out.writeObject(dest); 72 out.writeObject(selector); 73 int hasMessages = msgs != null ? 1 : 0; 74 out.writeByte(hasMessages); 75 if (hasMessages == 1) 76 out.writeObject(msgs); 77 } 78 public void read(ObjectInputStream in) throws IOException , ClassNotFoundException 79 { 80 super.read(in); 81 dest = (Destination ) in.readObject(); 82 selector = (String ) in.readObject(); 83 int hasMessages = in.readByte(); 84 if (hasMessages == 1) 85 msgs = (SpyMessage[]) in.readObject(); 86 } 87 } 88 | Popular Tags |