Chapter 20: Streams and Files
Sometimes data is written to a file instead of the computer screen. Under Unix and DOS you can sometimes do this using the redirection operators < and >. However sometimes you need a more fine-grained approach that writes only certain data to a file while still putting other data on the screen. Or you may need access to multiple files simultaneously. Or maybe you want to query the user for input rather than accepting it all on the command line. Or maybe you want to read data out of a file that's in a particular format. In Java all these methods require streams. In fact the System.out object you've been using since Chapter 2 is a stream.
In this chapter you learn
- How to write data onto a stream
- How to read data from a stream
- How to read data from the command line
- How to attach streams to files
- How to chain streams together
- How to work with files
- How to use FileDialogs
Examples from Other Chapters
[ Cafe Au Lait | Books | Trade Shows | Links | FAQ | Tutorial | User Groups ]
Copyright 120206 Elliotte Rusty Harold
elharo@sunsite.unc.edu
Last Modified July 23, 120206