Week 10: Input and Output with Streams

Streams

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. Or perhaps you want to send data to or read data from a network socket or a URL. In Java all these methods require streams. In fact the System.out object you've been using since class 1 is a stream.

Files

Readers and Writers


Start | Top
Last Modified December 10, 1997
Copyright 1997 Elliotte Rusty Harold
elharo@metalab.unc.edu