Class FileHandlingBudgetArchive
java.lang.Object
no.ntnu.idatt1002.demo.data.budget.FileHandlingBudgetArchive
Class that handles the reading and writing to the budget archive file, which contains all
existing budget projects. New budgets are added to the archive through this class.
- Since:
- 19.04.2023
- Author:
- Harry Linrui Xu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isBudgetRegisterEmpty
(String fileDestination) Checks if the budget register in the archive contains any budget names.static BudgetRegister
readBudgetArchive
(String fileDestination) Method for reading the budget register from the archive.static void
writeBudgetRegisterToArchive
(BudgetRegister budgetNames, String fileDestination) Method for writing (adding) a budget register to the archive.
-
Constructor Details
-
FileHandlingBudgetArchive
public FileHandlingBudgetArchive()
-
-
Method Details
-
writeBudgetRegisterToArchive
public static void writeBudgetRegisterToArchive(BudgetRegister budgetNames, String fileDestination) throws IOException Method for writing (adding) a budget register to the archive.- Parameters:
budgetNames
- The budget register.fileDestination
- The file destination in resources.- Throws:
IOException
- if an input or output exception occurred.
-
isBudgetRegisterEmpty
Checks if the budget register in the archive contains any budget names. In other words, if it is empty.- Parameters:
fileDestination
- The file destination in resources.- Returns:
- True, if only "null" is read. Else, returns false.
- Throws:
IOException
- if an input or output exception occurred.
-
readBudgetArchive
Method for reading the budget register from the archive.- Parameters:
fileDestination
- The file destination in resources.- Returns:
- The budget register that is read from file.
- Throws:
IOException
- if an input or output exception occurred.
-