Skip to Main Content
Java
book

Java

by Michael Sikora
January 2003
Beginner to intermediate content levelBeginner to intermediate
150 pages
7h 28m
English
Morgan Kaufmann
Content preview from Java
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
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JAVA Programming

JAVA Programming

K. Rajkumar
Java Programming

Java Programming

Hari Mohan Pandey
Java Programming

Java Programming

Poornachandra Sarang
Java 9 for Programmers

Java 9 for Programmers

Paul J. Deitel, Harvey Deitel

Publisher Resources

ISBN: 9781558609099