Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.snake.score;
- import java.io.*;
- public class Score{
- public static DataInputStream fileInput = null;
- public static DataOutputStream fileOutput = null;
- public static void onLoad(){
- File file = new File("score.txt");
- try{
- if(!file.exists())
- file.createNewFile();
- fileInput = new DataInputStream(new FileInputStream(file));
- fileOutput = new DataOutputStream(new FileOutputStream(file));
- } catch(FileNotFoundException e){
- e.printStackTrace();
- } catch(IOException e){
- e.printStackTrace();
- }
- }
- public static int onRead(){
- int score = 0;
- try {
- score = fileInput.readInt();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return score;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement