Java Reference
In-Depth Information
DAY 15:
Working with Input
and Output
Many of the programs you create with Java need to interact with some
kind of data source. Information can be stored on a computer in many
ways, including files on a hard drive or CD-ROM, pages on a website, and
even bytes in the computer's memory.
You might expect to need a different technique to handle each different
storage device. Fortunately, that isn't the case.
In Java, information can be stored and retrieved using a communications
system called streams, which are implemented in the java.io package.
Today, you learn how to create input streams to read information and out-
put streams to store information. You'll work with each of the following:
Byte streams, which are used to handle bytes, integers, and other
simple data types
n
Character streams, which handle text files and other text sources
n
You can deal with all data the same way when you know how to work with
an input stream, whether the information is coming from a disk, the
Internet, or even another program. The same holds for using output
streams to transmit data.
 
Search WWH ::




Custom Search