Package collectionManagers
Class CSVManager
java.lang.Object
collectionManagers.CSVManager
- All Implemented Interfaces:
- FileManager
The CSVManager class provides methods for working with files in .csv format.
 The class implements the Managers interface.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionreadFromFile(String pathToDataFile) Reads a CSV file at the specified path and returns an ArrayList containing each row of the file as a comma-separated string.voidWrites a collection of records to a CSV file at the specified path, using the given header and records array.
- 
Constructor Details- 
CSVManagerpublic CSVManager()
 
- 
- 
Method Details- 
readFromFileReads a CSV file at the specified path and returns an ArrayList containing each row of the file as a comma-separated string.- Specified by:
- readFromFilein interface- FileManager
- Parameters:
- pathToDataFile- The path to the CSV file to read.
- Returns:
- An ArrayList containing each row of the CSV file as a comma-separated string.
- Throws:
- IllegalArgumentException- If there was an error reading the CSV file, or if the file format was invalid.
 
- 
writeWrites a collection of records to a CSV file at the specified path, using the given header and records array.- Specified by:
- writein interface- FileManager
- Parameters:
- pathToDataFile- The path to the CSV file to write to.
- header- An array of strings representing the header row of the CSV file.
- records- An array of objects representing the records to write to the CSV file. Each record should be an array of objects corresponding to a row in the CSV file.
- Throws:
- IOException- If there was an error writing to the CSV file.
 
 
-