Skip to content

File Management

Jonathan Daniel edited this page Oct 7, 2017 · 3 revisions

File I/O

The majority of File I/O is handled with the Super CSV library. By using Super CSV, we are able to directly convert from the CSV file to commodity objects, which are stored in the currentCommodities ArrayList. All methods in this library are called by other methods in FileManager.

The File Manager

The purpose of FileManager is to manage all interactions with our save files for the app. Each method involving File I/O is listed in the File Manager class, as to not clutter any activities with the mess of File Management. The ordered list describing the File's interactions with the user are listed below. Note that instead of rewriting the File for each change, the commodities are first changed in an ArrayList, then saved to Disk upon exit. This minimizes the amount of RAM used, speeds up the processes in the app, and makes it easier overall to manage the data.

  1. User Launches App
  2. App Requests File I/O permissions
  3. Files in the Storage Directory are Listed to The User
  4. User either selects an existing file or creates a new file
  5. Commodities are loaded from this file and saved in an ArrayList
  6. User creates, edits, removes commodities in the ArrayList
  7. User exits app OR selects new file
  8. File is Written to Storage

Data Structure

SKU Number Product Name Size 1 Size 2-3 Size 4-5 Size 6-7 Total Per Box
987907907 Example Item 0 1 2 3 6 1

Clone this wiki locally