FileIO Flashcards
Which is the simpler searching algorithm to implement?
Linear Search
Which searching algorithm needs to use a sorted list?
Binary Search
What is a text file?
A file consisting of multiple lines of text characters
What classes are not standard in Java I/O?
InputFile and OutputFile classes
What is the purpose of I/O?
Storing data to ‘nonvolatile‘ devices, e.g. Harddrive
What are the two types of streams in Java?
- Text streams * Binary streams
What are the two directions of streams in Java?
- Input * Output
What are the four base-classes dealing with I/O in Java?
- Reader: text-input * Writer: text-output * InputStream: byte-input * OutputStream: byte-output
What character terminates a text file?
The new-line character ‘\n’
What is EOF in file processing?
End-of-file character
What is the general scheme for reading/writing in Java?
- Open an input/output stream * Read/write next data from/to the stream * Close the stream
Which class reads characters from a file?
FileReader Class
What does the BufferedReader class do?
Reads a line of text
What exception might be thrown during I/O operations?
IOException
Try-catch blocks are used for what purpose in I/O?
To handle exceptions
What class is used to write characters to a file?
FileWriter class
What is the benefit of using BufferedWriter?
Provides efficient writing
What should each element in a text file be terminated by?
- Space * Tab * New-line * EOF character
What is the difference between binary and text files?
- Binary files are more efficient but not human-readable * Text files are human-readable but less efficient
When should you use text files?
For final results if readability is essential
What classes simplify file I/O in the uulib package?
- InputFile * OutputFile
How do you check for EOF with InputFile?
Using the eof() method
What does the readInt() method do in InputFile?
Returns an integer read from the file
What is the purpose of close() method in file handling?
To close the file