Computer Science 268: Introduction to Computer Programming (Java)
Study Guide
Unit 11
Read Chapter 11 of the textbook: Input/Output Streams, Files, and Networking
It might seem that this chapter on input and output streams and files is an advanced topic; however, file input and output is a fundamental topic in Java programming, and we will examine it in this course.
Network programming is complex enough to warrant its own course and, for that reason, we do not delve into network programming in COMP 268.
Note: If you are interested in network programming, Athabasca University offers a variety of courses on that topic, including Computer Science 272: Data Structures and Algorithms; Computer Science 347: Computer Networks; and Computer Science 348: Network Programming in Java.
Section 11.1 I/O Streams, Readers, and Writers
This section introduces Input/Output (I/O) stream classes, followed by Reader and Writer classes.
Read and review this section carefully.
- 11.1.1 Character and Byte Streams
- 11.1.2 PrintWriter
- 11.1.3 Data Streams
- 11.1.4 Reading Text
- 11.1.5 The Scanner Class
- 11.1.6 Serialized Object I/O
Section 11.2 Files
This section includes reading and writing files, as well as files and directories. Section 11.2.3 covers GUI programming as it relates to file management; it is not covered in the course.
Read and review sections 11.2.1 and 11.2.2 carefully. Section 11.2.3 is not covered in the course.
- 11.2.1 Reading and Writing Files
- 11.2.2 Files and Directories
- 11.2.3 File Dialog Boxes
Section 11.3 Programming With Files
This section discusses some additional file I/O topics, such as copying a file and persistent data. The latter includes storing objects in files, also known as object persistence.
Read and review this section carefully.
- 11.3.1 Copying a File
- 11.3.2 Persistent Data
- 11.3.3 Storing Objects in Files
Section 11.4 Networking
This section of the textbook is not covered in the course.
- 11.4.1 URLs and URLConnections
- 11.4.2 TCP/IP and Client/Server
- 11.4.3 Sockets in Java
- 11.4.4 A Trivial Client/Server
- 11.4.5 A Simple Network Chat
Section 11.5 A Brief Introduction to XML
This section discusses one of the more significant topics regarding programming and the Internet: extensible markup language (XML). XML was adopted by many systems and processes in the early 2000s as a standard for data exchange, especially in Internet-based programs.
Read and review this section carefully.
- 11.5.1 Basic XML Syntax
- 11.5.2 Working With the DOM
It is a good practice to attempt the programming exercises in the textbook, to put the topics you have learned into concrete Java code. This, in turn, allows you to reflect on the material you have read. Skip any exercises relating to topics in Chapter 11 that are not covered in the course.
Resist the temptation to download the programming exercises from the textbook and simply run them. The greatest benefit in learning to program in a new language occurs when you type all the example code yourself.
Typing the code, even for simple examples, engages your brain in the process of writing code, compiling code, running code, and diagnosing and resolving problems that may arise. It is the latter skill—problem solving—that can become the most powerful tool in learning to program.
It is a good practice to review the chapter quizzes in the textbook, as the questions allow you to reflect on the material you have read.