1 24 package org.objectweb.joram.shared.client; 25 26 import java.io.Externalizable ; 27 import java.io.InputStream ; 28 import java.io.OutputStream ; 29 import java.io.IOException ; 30 31 import org.objectweb.joram.shared.stream.Streamable; 32 import org.objectweb.joram.shared.stream.StreamUtil; 33 34 38 public abstract class AbstractJmsReply extends AbstractJmsMessage { 39 40 protected int correlationId = -1; 41 42 43 public final void setCorrelationId(int correlationId) { 44 this.correlationId = correlationId; 45 } 46 47 48 public final int getCorrelationId() { 49 return correlationId; 50 } 51 52 55 public AbstractJmsReply() {} 56 57 62 public AbstractJmsReply(int correlationId) { 63 this.correlationId = correlationId; 64 } 65 66 public final String toString() { 67 StringBuffer strbuf = new StringBuffer (); 68 toString(strbuf); 69 return strbuf.toString(); 70 } 71 72 public void toString(StringBuffer strbuf) { 73 strbuf.append('(').append(super.toString()); 74 strbuf.append("correlationId=").append(correlationId); 75 strbuf.append(')'); 76 } 77 78 81 82 88 public void writeTo(OutputStream os) throws IOException { 89 StreamUtil.writeTo(correlationId, os); 90 } 91 92 98 public void readFrom(InputStream is) throws IOException { 99 correlationId = StreamUtil.readIntFrom(is); 100 } 101 } 102 | Popular Tags |