コード例 #1
0
ファイル: PropertyHandler.java プロジェクト: Desttro/Citizens
 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);
   }
 }
コード例 #2
0
ファイル: PropertyHandler.java プロジェクト: Desttro/Citizens
 @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);
     }
   }
 }
コード例 #3
0
ファイル: PropertyHandler.java プロジェクト: Desttro/Citizens
 @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);
     }
   }
 }