
CHAPTER 17: FILES AND STREAMS
1. Files โ long term retention of data
2. Computers use secondary storage devices
a. Hard disks, optical disks, flash drives, and magnetic tapes
3. Persistent data โ data maintained in files
4. Data stored in variables and arrays are temporary
5. KNOW THE DATA HIERARCHY
a. Bit
i. Either a 0 or a 1
b. Character set
i. Java uses Unicode characters which are two bytes
1. A byte is composed of 8 bits
c. Fields
i. Composed of characters or bytes
ii. Group of characters or bytes that conveys meaning
d. Record
e. File
6. Record Key โ identifies a record as belonging to a particular person or entity and is unique to each record
7. Most common way to organize records in a file is a sequential file
a. Stored in order of the record-key field
8. Database โ a group of related files
a. DBMS (database management system) โ a collection of programs designed to create and manage
databases.
9. Java views file as a sequential stream of bytes
10. Operating systems provides ways to determine when the end of a file comes, the end of the file marker
11. Java creates an object associated with a stream of bytes or characters in order to open a file
12. Class System is the big class that has methods and premade objects that will aid you with files and
streams
13. Uses class from package java.io
a. Has classes
i. FileInputStream
ii. FileOutputStream
iii. FileReader
iv. FileWriter
14. Class File provides information about files and directories
15. Character-based input and output can be performed with classes Scanner and Formatter
a. Scanner is used to input data
i. Can read data
b. Formatter is used to format the output
i. Such as printf
16. File provides four different constructors
17. Absolute path - contains all the directories
18. Root directory โ leads to a specific file or directory
19. Separator character โ used to separate directories and files in the path