Esempio n. 1
0
 public void saveCarpets() {
   File carpetDat = carpetsFile();
   log.info("Saving carpets...");
   if (!carpetDat.exists()) {
     try {
       carpetDat.createNewFile();
     } catch (IOException e) {
       log.severe("Unable to create carpets.dat; IOException");
     }
   }
   try {
     FileOutputStream file = new FileOutputStream(carpetDat);
     ObjectOutputStream out = new ObjectOutputStream(file);
     out.writeObject(carpets);
     out.close();
   } catch (IOException e) {
     log.warning("Error writing to carpets.dat; carpets data has not been saved!");
   }
   carpets.clear();
 }