You already know that:
• To write data in binary format, you use a
• To write in text format, you use a
Therefore, you might expect that there is an analog to the
DataInputStream that lets you read data in text format. The closest analog is the
Scanner class that we used extensively in Volume I. However, before Java SE 5.0, the only game in town for processing text input was the
BufferedReader class with the
readLine method that lets you read a line of text. You need to combine a buffered reader with an input source.
BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream("employee.txt"), "UTF-8));
readLine method returns ...