J2EEOnline J2EE 






Java Readers and Writers   «Prev  Next»
Lesson 1

Introduction Java Readers and Writers

Java Readers and Writers is the second course in the Networking with Java series.
This course teaches you how to manipulate files and how to use the Reader and Writer classes to read and write text files. In addition, you will learn about characters sets and encodings that allow Java to deal with those character sets.
After completing this course, you will be able to
  1. Manipulate files separately from their contents
  2. Determine information about a file
  3. Use the FileDialog class to choose files
  4. Connect readers and writers to input and output streams
  5. Use readers and writers to read and write strings and character arrays
  6. Use BufferedReaders to read text files one line at a time and use BufferedWriters to efficiently output them
  7. Write filter readers and writers that manipulate text before passing it on

While Java Readers and Writers does not deal directly with network programming, it covers skills that are prerequisite for anyone interested in writing programs that communicate over networks. The Networking with Java series progresses from courses teaching these prerequisite skills to courses dealing specifically with writing Java programs that communicate over networks.

Course length
This course should take you approximately 15 hours to complete. You can expect to spend 15 to 30 minutes on each lesson. Some lessons will take you longer, especially if there is an exercise to submit, and others may take 10 minutes. These numbers are only estimates and your pace through the course is entirely up to you.
Before you start the course, here is a short quiz question to test your knowledge of File I/O Fundamentals.


Which of the following methods are valid methods in the Java File Class.(Choose three options)
public class File extends Object implements Serializable, Comparable <File >
  1. Changes the current working directory:
    changeWorkingDirectory();
  2. Deletes a file :
    remove();
  3. Creates a file :
    createNewFile();
  4. Renames a file
    renameTo();
  5. Makes a directory :
    mkdir();


Answer: C, D, E
Explanation: Correct answers are options C, D and E. The File class does not provide any methods to change the current working directory. The delete() method attempts to delete a file or a directory and the createNewFile() method creates a new empty disk file.
The renameTo() method can be used to rename a file or a directory and the mkdir() method attempts to create a new directory.
Orientation
Please visit the sitemap, which contains all the links for the courses and modules on this website.
In the next few brief lessons, you will find out about course prerequisites, the course project, and what you need to get the most out of this course.