CIS 218 Course Materials

Overview

Java has two class hierarchies for I/O: The Reader/Writer classes are used for text I/O, and the Input/Output Stream classes are used for binary I/O.
The InputStreamReader class is an important class that provides a bridge between the text/binary class hierarchies. Some classes identify the source of the I/O (FileWriter, PipedInputStream), while others layer functionality on top (BufferedReader, PrintWriter).
These classes are usually used in combination. See ReadFile for a straight-forward example of this ( A FileReader is created

Object Serialization is a technique in which an entire object can be written (binary) with little effort by the programmer ( see java.io.ObjectOutputStream, java.io.ObjectInputStream, and java.io.Serializable) as long as the class to be written implements the Serializable interface. Writing using this technique involves an overhead in terms of disk space, however. to identify the source of the I/O. It is then passed to the constructor of a BufferedReader so that we can read an entire line at a time from the file).
FileOps.java - Utility operations for files. Creating a File object does NOT create a file in the OS
ReadConsole.java - Demonstration of reading text data from the console
ReadFile.java - Demonsration of reading text data from a file
WriteFile.java - Combines reading text from a console and writing text to a file
BankRecord.java - A non-I/O class used in the ATM simulator examples
ATMSimulator.java - Writing data to file using binary (stream) I/O
BalanceCalculator.java - Reading binary data from a file
ATMSimulatorOS.java - Writing data to file using a special kind of binary I/O : Object Serialization
TestThrowFinally.java - In a try/catch/finally structure, if an uncaught exception is thrown in the catch block does the finally block still execute? Yes!
Back to Current Session | Web Publishing | Faculty Directory | Maps and Directions | Search
Copyright © 1997 College of DuPage
Computer Information Systems
(630) 942-2800 x51902
goodacrc@cdnet.cod.edu
Updated 19 Jun 2003
Disclaimer