Added Serialisation for the Session Code

This commit is contained in:
YaFedImYaEatIm
2016-09-16 17:03:17 +12:00
parent d0148d9e73
commit bf8c1d1fdf
2 changed files with 11 additions and 4 deletions
BIN
View File
Binary file not shown.
@@ -1,8 +1,6 @@
package seng202.group9.Controller; package seng202.group9.Controller;
import java.io.IOException; import java.io.*;
import java.io.InputStream;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import javafx.application.Application; import javafx.application.Application;
@@ -120,7 +118,16 @@ public class App extends Application
* Serialize the exiting session * Serialize the exiting session
*/ */
public void stop(){ 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. * Replace Scene Content with fxml file code from oracle.