Object Oriented Programming Final File IO

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/20

flashcard set

Earn XP

Description and Tags

From Dr. Pittman Lecture Slides

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

21 Terms

1
New cards

File

A collection of 1s and 0s stored on a computer

2
New cards

Absolute File Path

Exact path to a file starting at the root of the file system

3
New cards

Relative File Path

Path to a file relative to the working directory

4
New cards

Aspects of Absolute File Path

Gives name of each folder that needs to be opened. Very tedious and are computer specific

5
New cards

Aspects of Relative File Path

Most programs use this sine it allows for the paths to be more flexible and run on multiple systems

6
New cards

to go down a tree

7
New cards

..

to go up the tree one folder

8
New cards

.

denotes the current directory/folder

9
New cards

File Class

getAbsolutePath()

canWrite()

canRead()

length()

exists()

10
New cards

FileInputStream Class

used to read raw bytes of data from a file; works for any type of file

11
New cards

FileReader

Reads unicode values from the text files; works well to store text data

12
New cards

Input Streams

FileInputStream

FileReader

Read method returns 1 at the end of stream

13
New cards

Scanner Class

Scanner scnr = new Scanner(medicalData);

String id = scnr.next(); (gets next char)

int weight = scnr.nextInt(); (gets next int)

double temperature = scnr.nextDouble(); (gets next double

14
New cards

File Output

FileOutputStream

FileWriter

15
New cards

FileOutputStream Class

FileOutputStream.write(72);

Used to write raw byte data to a file, and can be used to create files of any type

16
New cards

FileWriter Class

FileWriter.write(“H”);

Used to write text data to a file

17
New cards

PrintWriter Class

printWriter.println(“Hello”);

Can be used to wrap an output stream

Gives access to methods normally used for printing to console.

18
New cards

Buffers

allows for data stored in a cache until a certain threshold is reached.

19
New cards

Read Buffer

When empty makes a request to fill in the buffer with data from the designated file

20
New cards

Write Buffer

When full makes a request to write the data to the designated file.

21
New cards

.flush()

force any data currently held in a temporary buffer to be immediately written or transmitted to its final destination