Files and I/O (Cont.)
Reading a File
In the following example, we use the Scanner
class to read the contents of the text file we created in the previous example:
Some of the file classes are given next (cont.):
FileWriter
, which is used for writing streams of characters
BufferedWriter
, which writes text to a character-output stream, buffering characters so as to provide for the efficient writing (better performance) of single characters, arrays, and strings
FileOutputStream
, which is useful to read data from a file in the form of sequence of bytes