KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > nutch > ndfs > HeartbeatData


1 /* Copyright (c) 2004 The Nutch Organization. All rights reserved. */
2 /* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */
3 package net.nutch.ndfs;
4
5 import net.nutch.io.*;
6 import net.nutch.ipc.*;
7 import net.nutch.util.*;
8
9 import java.io.*;
10 import java.net.*;
11 import java.util.*;
12
13 /********************************************************
14  * Heartbeat data
15  *
16  * @author Mike Cafarella
17  ********************************************************/

18 public class HeartbeatData implements Writable, FSConstants {
19     UTF8 name;
20     long capacity, remaining;
21
22     /**
23      */

24     public HeartbeatData() {
25         this.name = new UTF8();
26     }
27         
28     /**
29      */

30     public HeartbeatData(String JavaDoc name, long capacity, long remaining) {
31         this.name = new UTF8(name);
32         this.capacity = capacity;
33         this.remaining = remaining;
34     }
35         
36     /**
37      */

38     public void write(DataOutput out) throws IOException {
39         name.write(out);
40         out.writeLong(capacity);
41         out.writeLong(remaining);
42     }
43
44     /**
45      */

46     public void readFields(DataInput in) throws IOException {
47         this.name = new UTF8();
48         name.readFields(in);
49         this.capacity = in.readLong();
50         this.remaining = in.readLong();
51     }
52
53     public UTF8 getName() {
54         return name;
55     }
56     public long getCapacity() {
57         return capacity;
58     }
59     public long getRemaining() {
60         return remaining;
61     }
62 }
63
Popular Tags