Chapter 10
Chapter Contents
Chapter Objectives
10.1 Introductory Example: Weather Data Analysis
10.2 Java/s I/O System: Readers, Writers, Streams
10.3 Exceptions
10.4 More About I/O Streams
10.5 Example: Scanning for a Virus
10.6 Example: Student Data Retrieval
10.7 Graphical/Internet Java: Student Data Retrieval GUI
Part of the Picture: Data Base Systems
Chapter Objectives
Input Output
Stream Stream
Executing Program
Predefined Streams
System.in
InputStream object, usually for the keyboard
System.out
a buffered PrintStream object, usually the
screen or an active window
System.err
an unbuffered PrintStream object usually
associated with the screen or console window
Wrapping Classes
valueString = inFile.readLine():
while (valueString != null)
{ // process valueString
valueString = inFile.readLine(); }
Also
possible to check for other things such as
an empty line with no text
if (valueString.equals("")) continue;
Using a Reader
E x c e p t io n
D a t a F o r m a t E x c e p t io n I O E x c e p t io n . . . R u n t im e E x c e p t io n
E O F E x c e p t io n F ile N o t F o u n d E x c e p t io n . . . I n t e r r u p t e d I O E x c e p t io n
Exceptions become
more specialized
Try/Catch Strategy
What is a virus?
software that hides itself within other executable
programs
that executable program is the "host" for the virus
the virus program tries to "infect" other programs
the virus can cause problems that range from
annoying to malicious
A virus that prints an annoying message stores
that string value within itself
we will write a program that searches through a file
to find that text, or signature
Virus-Detection Algorithm
Based on data
accuracy and detail help make better decisions
large data sets stored on computers
Data
sets maintained by Database
Management Systems (DBMS)
DBMS Facilities