KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > util > Range


1 // $Id: Range.java,v 1.5 2004/10/04 20:43:35 belaban Exp $
2

3 package org.jgroups.util;
4
5
6 import java.io.*;
7
8
9
10 public class Range implements Externalizable, Streamable {
11     public long low=-1; // first msg to be retransmitted
12
public long high=-1; // last msg to be retransmitted
13

14
15
16     /** For externalization */
17     public Range() {
18     }
19
20     public Range(long low, long high) {
21         this.low=low; this.high=high;
22     }
23
24
25
26     public String JavaDoc toString() {
27         return "[" + low + " : " + high + ']';
28     }
29
30
31     public void writeExternal(ObjectOutput out) throws IOException {
32         out.writeLong(low);
33         out.writeLong(high);
34     }
35
36
37
38     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException JavaDoc {
39         low=in.readLong();
40         high=in.readLong();
41     }
42
43
44     public void writeTo(DataOutputStream out) throws IOException {
45         out.writeLong(low);
46         out.writeLong(high);
47     }
48
49     public void readFrom(DataInputStream in) throws IOException, IllegalAccessException JavaDoc, InstantiationException JavaDoc {
50         low=in.readLong();
51         high=in.readLong();
52     }
53 }
54
Popular Tags