Murach's Java SE 6
How to work with text and binary files

File handling is still an important part of many business applications. So this chapter shows you how to read and write text files sequentially and how to read and write binary files either sequentially or randomly.

Chapter 19 How to work with text and binary files
Introduction to files and directories 624
Constructors and methods of the File class 624
Code examples that work with directories and files 626
Introduction to file input and output 628
How files and streams work 628
A file I/O example 630
How to work with I/O exceptions 632
How to work with text files 634
How to connect a character output stream to a file 634
How to write to a text file 636
How to connect a character input stream to a file 638
How to read from a text file 640
An interface for working with file I/O 642
A class that works with a text file 644
How to work with binary files 650
How to connect a binary output stream to a file 650

How to write to a binary file

652
How to connect a binary input stream to a file 654
How to read from a binary file 656
Two ways to work with binary strings 658
How to work with random-access files 660
How to connect to a random-access file 660

How to read to and write from a random-access file

662
How to read and write fixed-length strings 664
A class that works with a random-access file 666




Murach's Java SE 6

Learn more about this book

Add this book to your cart



Our Ironclad Guarantee

First, try our books for 90 days. Then, if you aren't completely convinced that our books are the best ones you've ever used, you can return them for a full refund...no questions asked.