From bf8c1d1fdf0503a0aadae8a6df71e911123bbdb8 Mon Sep 17 00:00:00 2001 From: YaFedImYaEatIm Date: Fri, 16 Sep 2016 17:03:17 +1200 Subject: [PATCH] Added Serialisation for the Session Code --- res/session.ser | Bin 0 -> 202 bytes src/main/java/seng202/group9/Controller/App.java | 15 +++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 res/session.ser diff --git a/res/session.ser b/res/session.ser new file mode 100644 index 0000000000000000000000000000000000000000..7139935802ec9bfaf5d64fecd82a9eb0f4ab9170 GIT binary patch literal 202 zcmZ4UmVvdnh(WP9H80)Bz(_B>D8ID8QqMU*ucRnHCnvQ?FF3WhI5R&_F7~FtL$xyv zObm=Z41C4Osd=d`nZ*S;iIu4-B@C)QPy_TK2IwOU&<_TwbhIl&q002u5KKB3s literal 0 HcmV?d00001 diff --git a/src/main/java/seng202/group9/Controller/App.java b/src/main/java/seng202/group9/Controller/App.java index 599d03f..5675473 100644 --- a/src/main/java/seng202/group9/Controller/App.java +++ b/src/main/java/seng202/group9/Controller/App.java @@ -1,8 +1,6 @@ package seng202.group9.Controller; -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; +import java.io.*; import java.util.ArrayList; import javafx.application.Application; @@ -120,7 +118,16 @@ public class App extends Application * Serialize the exiting session */ public void stop(){ - + try{ + FileOutputStream fileOut = new FileOutputStream("res/session.ser"); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(session); + out.close(); + fileOut.close(); + System.out.println("Session has been serialised for next load"); + }catch(IOException e){ + e.printStackTrace(); + } } /** * Replace Scene Content with fxml file code from oracle.