예제 #1
0
파일: Manager.java 프로젝트: JCortz/SD
 public Manager loadManager() throws IOException, ClassNotFoundException {
   try {
     String workingDir = System.getProperty("user.dir");
     FileInputStream fin = new FileInputStream(workingDir + "\\Manager.ser");
     ObjectInputStream oin = new ObjectInputStream(fin);
     Manager m = (Manager) oin.readObject();
     if (m != null) return m;
     else return new Manager(new Warehouse());
   } catch (IOException e) {
     System.out.println("\nerror loading file!\n");
     return new Manager(new Warehouse());
   }
 }
예제 #2
0
 // Deserialize properly
 private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
   s.defaultReadObject();
   setState(0); // reset to unlocked state
 }