Beispiel #1
0
  public void writePersonalSchedule(PersonalSchedule p) {

    try {
      if (ps.exists()) {
        ps.delete();
      }
      ps.createNewFile();
      ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(ps));
      oos.writeObject(p);
      oos.close();
    } catch (IOException e) {
      log.logException(e);
      e.printStackTrace();
    }
  }
Beispiel #2
0
  public PersonalSchedule readPersonalSchedule() {
    if (!ps.exists()) return null;
    try {
      ObjectInputStream ois = new ObjectInputStream(new FileInputStream(ps));
      Object obj = ois.readObject();
      ois.close();
      // 记录文件同一村粗到磁盘上
      if (obj instanceof PersonalSchedule) {
        return (PersonalSchedule) obj;
      }

    } catch (Exception e) {
      log.logException(e);
    }
    return null;
  }