Input and Output in Java

The java.io package contains classes that perform input and output. In Java, I/O classes are differentiated according to the type of data being read or written. Byte oriented and numeric data is written with output streams and read with input streams. Character data, that is text, is written with writers and read with readers. Readers and writers operate much like streams but understand how to convert to and from various external character sets like Big-5 Chinese or MacRoman into Unicode. Whether you use streams or readers and writers depends on the type of data you're dealing with. In Java 1.1 and later all text data, especially non-ASCII text, should be passed through a reader or writer.

The two main stream classes are java.io.InputStream and java.io.OutputStream. The two main reader and writer classes are java.io.Reader and java.io.Writer These are abstract base classes for many different subclasses with more specialized abilities.


Previous | Next | Top
Last Modified April 24, 1997
Copyright 1997, 1998 Elliotte Rusty Harold
elharo@metalab.unc.edu