Reading Files

Up until now we have used a database anytime we need to store data, but databases are not our only data storage option. For many business or web applications it makes the most sense to store data inside of a database. Many applications, however, use text files to store data. Text files are also a common way to share data between applications.

Updated

Working with the File Object

  1. Working with the File Object: an overview (Apprentice): A Java `File` object points at a path so you can inspect it; creating one does not open the file.
  2. File Object Methods (Apprentice): The `File` methods that create, delete and check files and directories, and list what a directory holds.

Working with Exceptions

  1. Working with Exceptions (Apprentice): What can go wrong when reading a file, and how `try...catch` and try-with-resources keep your application from crashing.

Reading a File

  1. Reading a File (Apprentice): How to read a CSV file line by line with a `Scanner` and turn each line into an object in a list.