
98
Chapter 7: Input/Output I
the DataInputStream read methods reach the end of the file. Within the try statement, we start
an infinite loop in line 14.
In lines 15-18, we use the DataInputStream.readChar method to read a single character,
singlechar, from the stream. Each character is appended to the variable item, a StringBuffer
data type, until we read a field separator.
In line 19, we read the price from the stream using the DatalnputStream.readFloat
method. We use the readChar method to skip the field separator (line 20), then read the quantity
using the readInt method (line 21). We use the readChar method again