Murach's Java Programming
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 18 How to work with text and binary files
Introduction to directories and files 560
A package for working with directories and files 560
Code examples that work with directories and files 562
Introduction to file input and output 564
How files and streams work 564
A file I/O example 566
How to work with I/O exceptions 568
How to work with text files 570
How to connect a character output stream to a file 570
How to write to a text file 572
How to connect a character input stream to a file 574
How to read from a text file 576
An interface for working with file I/O 578
A class that works with a text file 580
How to work with binary files 584
How to connect a binary output stream to a file 584

How to write to a binary file

586
How to connect a binary input stream to a file 588
How to read from a binary file 590
Two ways to work with binary strings 592
How to work with random-access files 594
How to connect to a random-access file 594

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

596
How to read and write fixed-length strings 598
A class that works with a random-access file 600




Murach's Java Programming

Learn more about this book

View the table of contents


More about the eBook



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.