public static void save(FileIO files) { BufferedWriter out = null; try { out = new BufferedWriter(new OutputStreamWriter(files.writeFile(file))); out.write(Boolean.toString(soundEnabled)); out.write("/n"); for (int i = 0; i < 5; i++) { out.write(Integer.toString(highscores[i])); out.write("/n"); } out.write(Integer.toString(currentRound)); } catch (IOException e) { } finally { try { if (out != null) out.close(); } catch (IOException e) { } } }
public static void load(FileIO files) { BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(files.readFile(file))); soundEnabled = Boolean.parseBoolean(in.readLine()); for (int i = 0; i < 5; i++) { highscores[i] = Integer.parseInt(in.readLine()); } currentRound = Integer.parseInt(in.readLine()); } catch (IOException e) { } catch (NumberFormatException e) { } finally { try { if (in != null) in.close(); } catch (IOException e) { } } }