Package edu.ntnu.idi.idatt.filehandler
Interface FileHandler<T>
- All Known Implementing Classes:
LadderGameBoardFileHandlerGson
,LudoBoardFileHandlerGson
,PlayerFileHandlerCsv
public interface FileHandler<T>
Interface for handling files.
This interface defines methods for reading from and writing to a file. It uses a generic type T to represent the type of the file contents (e.g. Player, Board, etc.).
-
Method Summary
-
Method Details
-
readFile
Reads the contents of a file and returns the file contents. The return type can be anything, as long as it is a valid object.- Parameters:
filePath
- the path to the file- Returns:
- The object read from the file
- Throws:
IOException
- if an error occurs while reading the file
-
writeFile
Writes contents to a file, using the given file path.- Parameters:
filePath
- the path to the filecontents
- the list of contents to write to the file- Throws:
IOException
- if an error occurs while writing to the file
-