CHAPTER 7
INPUT/OUTPUT AND EXCEPTION HANDLING
CHAPTER GOALS
To read and write text files
To process command line arguments
To throw and catch exceptions
To implement programs that propagate checked exceptions
CHAPTER CONTENTS
7.1 READING AND WRITING TEXT FILES
Common Error 7.1: Backslashes in File names
Common Error 7.2: Constructing a scanner with a string
Special Topic 7.1: Reading Web Pages
Special Topic 7.2: File Dialog Boxes
Special Topic 7.3: Reading and Writing Binary Data
Special Topic 7.4: Regular Expressions
Video Example 7.1: Computing a Document's Readability
How To 7.1: Processing Text Files
Random Fact 7.1: Encryption Algorithms
Worked Example 7.1: Analyzing Baby Names
Syntax 7.1: Throwing an Exception
Syntax 7.2: Catching Exceptions
Syntax 7.4: The finally Clause
Programming Tip 7.1: Throw Early, Catch Late
Programming Tip 7.2: Do Not Squelch Exceptions
Programming Tip 7.3: Do Not Use catch and finally in the Same try Statement
Special Topic 7.5: Automatic Resource Management in Java 7
Get Java For Everyone: Compatible with Java 5, 6, and 7, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.