summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/CDDBStatus.java
blob: bcf8922fabed0536799ad12a6d240ff96be2ad16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package NET.worlds.scape;

import java.io.IOException;

public class CDDBStatus implements Persister {
   private int status;
   private CDDiskInfo diskInfo;
   private static Object classCookie = new Object();

   public CDDBStatus(int status, CDDiskInfo diskInfo) {
      this.status = status;
      this.diskInfo = diskInfo;
   }

   public CDDBStatus(int status) {
      this.status = status;
   }

   public CDDBStatus() {
   }

   public int getStatus() {
      return this.status;
   }

   public CDDiskInfo getDiskInfo() {
      return this.diskInfo;
   }

   @Override
   public void saveState(Saver s) throws IOException {
      s.saveVersion(1, classCookie);
      s.saveInt(this.status);
      s.saveMaybeNull(this.diskInfo);
   }

   @Override
   public void restoreState(Restorer r) throws IOException, TooNewException {
      switch (r.restoreVersion(classCookie)) {
         case 1:
            this.status = r.restoreInt();
            this.diskInfo = (CDDiskInfo)r.restoreMaybeNull();
            return;
         default:
            throw new TooNewException();
      }
   }

   @Override
   public void postRestore(int version) {
   }
}