Exception_Prototype

Untitled

Oct 29th, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1.     public void saveConfig() {
  2.         try {
  3.             if (this.configFile.exists()) {
  4.                 this.configFile.delete();
  5.             }
  6.  
  7.             if (this.configFile.createNewFile()) {
  8.                 try (Writer writer = new BufferedWriter(new OutputStreamWriter(
  9.                         new FileOutputStream(configFile), "UTF-8"))) {
  10.                     this.gson.toJson(list, List.class, writer);
  11.                 }
  12.             }
  13.  
  14.         } catch (IOException ex) {
  15.             Logging.severe("Error save config", ex);
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment