Java I/O
Java I/O
Please turn off all
How I Got Interested in Java I/O
The Main Theme:
What is a stream?
Where do streams come from
The Base Classes
The Stream Subclasses
Numeric data
The console
Writing bytes to the console
Security Issues
Character data
The OutputStream class
Writing Bytes to Output Streams
Flushing Output Streams
Closing Output Streams
Subclassing OutputStream
An OutputStream Subclass
The InputStream Class
The read() method
Example of the read() method
Reading several bytes at once
Counting the available bytes
Skipping bytes
Marking and Resetting
Closing Input Streams
Subclassing InputStream
An InputStream subclass
Writing Files
Writing Files; An Example
Appending Data to Files Streams
Reading Files
Filter Streams
The Filter Stream Classes
Buffered Streams
PushbackInputStream
PrintStream
PrintStream is Evil
Data Streams
DataOutputStream
DataInputStream
readLine() is Evil!
GZIPOutputStream
GZIPInputStream
Subclassing FilterOutputStream
Subclassing FilterInputStream
Character Sets
Readers and Writers
The Writer class
OutputStreamWriter
The Reader class
InputStreamReader
Other Readers and Writers
PrintWriter
BufferedReader
BufferedReader readLine() example
Filter Readers and Writers
Formatted I/O
The Old Way
The New Way
Locales
Number Format
Formatting Numbers
Number Format example
Specifying Precision
Precision Example
How big is 299792500?
Grouping
Currency Formats
Percent Formats
Parsing Input
CS 101 Homework
Exponentials
Streams are not Thread Safe
Future Improvements and Additions
To Learn More
Questions?
Entire Presentation as Single File
Start
|
Cafe con Leche
Copyright 2000
Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified January 9, 2001