private Game loadGame() {
try{
InputStream file = new FileInputStream("saved/" + gameId.toString() + ".game");
InputStream buffer = new BufferedInputStream(file);
ObjectInput input = new CopierObjectInputStream(Main.classLoader, new GZIPInputStream(buffer));
try {
Game game = (Game)input.readObject();
GameStates states = (GameStates)input.readObject();
game.loadGameStates(states);
return game;
}
finally {
input.close();
}
}
catch(ClassNotFoundException ex) {
logger.log(Level.SEVERE, "Cannot load game. Class not found.", ex);
}