Java Reference
In-Depth Information
10
File I/O
10.1 INTRODUCTION TO FILE I/O
578
Streams 578
Text Files and Binary Files 579
10.3 THE
File
CLASS
609
Programming with the
File
Class 609
10.4 BINARY FILES
★
613
Writing Simple Data to a Binary File 614
UTF and
writeUTF
618
Reading Simple Data from a Binary File 619
Checking for the End of a Binary File 624
Binary I/O of Objects 626
The
Serializable
Interface 627
Array Objects in Binary Files 630
10.2 TEXT FILES
580
Writing to a Text File 580
Appending to a Text File 587
Reading from a Text File 589
Reading a Text File Using
Scanner
589
Testing for the End of a Text File with
Scanner
592
Reading a Text File Using
BufferedReader
599
Testing for the End of a Text File with
BufferedReader
603
Path Names 605
Nested Constructor Invocations 606
System.in
,
System.out
, and
System.err
607
10.5 RANDOM ACCESS TO
BINARY FILES
★
632
Reading and Writing to the Same File 632
Chapter Summary 638
Answers to Self-Test Exercises 639
Programming Projects 643