13-20101130 - Introduction to OO Program Design Software...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to OO Program Design Software College of SCU Instructor: Shu Li Email: shuli@scu.edu.cn
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Unit 3.1 Input and Output Programming 3.1.0 Java I/O Stream 3.1.1 File I/O 3.1.2 Using File I/O in the Library System
Background image of page 2
3 Java I/O Stream What is an I/O stream? Types of Streams Stream class hierarchy Control flow of an I/O operation using Streams Byte streams Character streams Buffered streams Standard I/O streams Data streams Object streams File class
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 What is an I/O Stream? An I/O Stream represents an input source or an output destination A stream can represent many different kinds of sources and destinations disk files, devices, other programs, a network socket, and memory arrays Streams support many different kinds of data simple bytes, primitive data types, localized characters, and objects
Background image of page 4
5 I/O Streams No matter how they work internally, all streams present the same simple model to programs that use them A stream is a sequence of data
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Input Stream A program uses an input stream to read data from a source (a file, memory, a socket), and reads the information sequentially, one item at a time.
Background image of page 6
7 Output Stream A program uses an output stream to write data to a destination, and writing the information out sequentially, one item at time.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Types of Streams General Stream Types Character and Byte Streams Character vs. Byte Input and Output Streams Based on source or destination Node and Filter Streams Whether the data on a stream is manipulated or transformed or not
Background image of page 8
9 Character and Byte Streams Byte streams For binary data Root classes for byte streams: The InputStream Class The OutputStream Class Both classes are abstract Classes of Byte Streams InputStream o OutputStream FileInputStream o FileOutputStream PipedInputStream o PipedOutputStream ByteArrayInputStream o ByteArrayOutputStream FilterInputStream o FilterOutputStream DataInputStream o DataOutputStream BufferedInputStream o BufferedOutputStream
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Character and Byte Streams Character Streams For Unicode characters Root classes for character streams The Reader class The Writer class Both classes are abstract Most programs should use readers and writers to read and write textual information. Reader o Writer InputStreamReader o OutputStreamWriter FileReader o FileWriter CharArrayReader o CharArrayWriter PipedReader o PipedWriter FilterReader o FilterWriter BufferedReader o BufferedWriter StringReader o StringWriter
Background image of page 10
11 Input and Output Streams Input or source streams Can read from these streams Root classes of all input streams: The InputStream Class The Reader Class Output or sink (destination) streams Can write to these streams Root classes of all output streams: The OutputStream Class The Writer Class
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 Node and Filter Streams
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/12/2011 for the course ECON 101 taught by Professor Professor during the Spring '10 term at Cisco Junior College.

Page1 / 82

13-20101130 - Introduction to OO Program Design Software...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online