Example #1
0
 private void createFile(File file) {
   try {
     Messaging.log("Creating missing file at " + fileName + ".");
     file.getParentFile().mkdirs();
     file.createNewFile();
   } catch (IOException ex) {
     Messaging.log("Unable to create " + file.getPath() + ".", Level.SEVERE);
   }
 }
Example #2
0
 @Override
 public void save() {
   FileOutputStream stream = null;
   try {
     stream = new FileOutputStream(this.fileName);
     this.properties.store(stream, "Citizens File");
   } catch (IOException ex) {
     Messaging.log("Unable to save " + this.fileName, Level.SEVERE);
   } finally {
     try {
       if (stream != null) {
         Messaging.debug("Save stream closed.");
         stream.close();
       }
     } catch (IOException e) {
       Messaging.log("Unable to close " + this.fileName, Level.SEVERE);
     }
   }
 }
Example #3
0
 @Override
 public void load() {
   FileInputStream stream = null;
   try {
     stream = new FileInputStream(this.fileName);
     this.properties.load(stream);
   } catch (IOException ex) {
     Messaging.log("Unable to load " + this.fileName, Level.SEVERE);
   } finally {
     try {
       if (stream != null) {
         Messaging.debug("Load stream closed.");
         stream.close();
       }
     } catch (IOException e) {
       Messaging.log("Unable to close " + this.fileName, Level.SEVERE);
     }
   }
 }