Example #1
0
 public Save(String fileName) {
   try {
     // read something about java.utils.prefs.Preferences
     file = new File(fileName);
     if (!file.exists()) {
       FileOutputStream out = new FileOutputStream(fileName);
       out.close();
       System.out.println("file made");
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Example #2
0
 public void write(byte[] data) throws IOException {
   this.data = data;
   System.out.println(data.length);
   if (file.length() > 1000) {
     System.out.println("Exists");
     // Prompt user to overwrite the save file
     // Allow user to overwrite save file
   } else {
     try {
       FileOutputStream out = new FileOutputStream(file);
       out.write(data);
       out.close();
       // IOUtils.write(data, output);
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }