Class HandBallAppFileHandling
java.lang.Object
edu.ntnu.idatt1002.g106.handballapp.finalprod.fileHandling.HandBallAppFileHandling
This class provides method to serialize and deserialize a TournamentRegister
- Author:
- Group 6
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TournamentRegister
Deserialize a tournamentRegister from theparam file
static boolean
serializeTournamentRegister
(TournamentRegister tournamentRegister, File file) Method serializes anparam army
to theparam file
-
Constructor Details
-
HandBallAppFileHandling
public HandBallAppFileHandling()
-
-
Method Details
-
serializeTournamentRegister
public static boolean serializeTournamentRegister(TournamentRegister tournamentRegister, File file) throws IOException Method serializes anparam army
to theparam file
- Parameters:
tournamentRegister
- The tournamentRegister to serializefile
- The file to serialize to- Returns:
true
if the serialization succeed orfalse
if theparam tournamentRegister
is null- Throws:
IOException
- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
-
deserializeTournamentRegister
public static TournamentRegister deserializeTournamentRegister(File file) throws IOException, ClassNotFoundException Deserialize a tournamentRegister from theparam file
- Parameters:
file
- The file to deserialize from- Returns:
- The deserialized tournamentRegister if there is registered a tournamentRegister, otherwise null
- Throws:
IOException
- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reasonClassNotFoundException
- if the class of the serialized object cannot be found
-