Java Reference
In-Depth Information
10.1 Introduction to File I/O
574
Streams
575
10
Text Files and Binary Files
575
10.2 Text Files
576
Writing to a Text File
576
Appending to a Text File
583
Reading from a Text File
586
Reading a Text File Using
586
Scanner
Testing for the End of a Text File with
589
Scanner
File I/O
Reading a Text File Using
597
BufferedReader
Testing for the End of a Text File with
602
BufferedReader
Path Names
604
Nested Constructor Invocations
605
,
, and
606
System.in
System.out
System.err
10.3 The
Class
609
File
Programming with the
Class
609
File
★
10.4 Binary Files
614
Writing Simple Data to a Binary File
614
and
619
UTF
writeUTF
Reading Simple Data from a Binary File
620
Checking for the End of a Binary File
625
Binary I/O of Objects
626
The
Interface
631
Serializable
Array Objects in Binary Files
632
★
10.5 Random Access to Binary Files
632
Reading and Writing to the Same File
634
Chapter Summary
640
Answers to Self-Test Exercises
641
Programming Projects
645