Package it.polimi.ingsw.controller
Class FILEHelper
java.lang.Object
it.polimi.ingsw.controller.FILEHelper
helper class for reading and writing txt file, useful for persistence
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
check if there is a cache server from a previous gamestatic Game
load the current state of the server from the file server.txtstatic void
write 'FAIL' on status.txt indicating tha the server closed in a NOT normal waystatic void
writeServer
(Game server) save the current state of the server in the file server.txtstatic void
write 'SUCC' on status.txt indicating tha the server closed in a normal way
-
Constructor Details
-
FILEHelper
public FILEHelper()
-
-
Method Details
-
writeSucc
public static void writeSucc()write 'SUCC' on status.txt indicating tha the server closed in a normal way -
writeFail
public static void writeFail()write 'FAIL' on status.txt indicating tha the server closed in a NOT normal way -
havaCachedServer
public static boolean havaCachedServer()check if there is a cache server from a previous game- Returns:
- true iff there is a cached server
-
writeServer
save the current state of the server in the file server.txt- Parameters:
server
- the current server that will be saved
-
loadServer
load the current state of the server from the file server.txt- Returns:
- the state of the old server that was saved (Game Object)
-