KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > protocols > pbcast > JoinRsp


1 // $Id: JoinRsp.java,v 1.5 2004/10/08 13:04:37 belaban Exp $
2

3 package org.jgroups.protocols.pbcast;
4
5
6 import org.jgroups.View;
7 import org.jgroups.util.Streamable;
8 import org.jgroups.util.Util;
9
10 import java.io.Serializable JavaDoc;
11 import java.io.DataOutputStream JavaDoc;
12 import java.io.IOException JavaDoc;
13 import java.io.DataInputStream JavaDoc;
14
15
16 public class JoinRsp implements Serializable JavaDoc, Streamable {
17     View view=null;
18     Digest digest=null;
19
20     public JoinRsp() {
21
22     }
23
24     public JoinRsp(View v, Digest d) {
25         view=v;
26         digest=d;
27     }
28
29
30     View getView() {
31         return view;
32     }
33
34     Digest getDigest() {
35         return digest;
36     }
37
38     public void writeTo(DataOutputStream JavaDoc out) throws IOException JavaDoc {
39         Util.writeStreamable(view, out);
40         Util.writeStreamable(digest, out);
41     }
42
43     public void readFrom(DataInputStream JavaDoc in) throws IOException JavaDoc, IllegalAccessException JavaDoc, InstantiationException JavaDoc {
44         view=(View)Util.readStreamable(View.class, in);
45         digest=(Digest)Util.readStreamable(Digest.class, in);
46     }
47
48     public String JavaDoc toString() {
49         StringBuffer JavaDoc sb=new StringBuffer JavaDoc();
50         sb.append("view: ");
51         if(view == null)
52             sb.append("<null>");
53         else
54             sb.append(view);
55         sb.append(", digest: ");
56         if(digest == null)
57             sb.append("<null>");
58         else
59             sb.append(digest);
60         return sb.toString();
61     }
62 }
63
Popular Tags