Main Page

Previous Next

Chapter 10: Writing Files

Overview

In this chapter, we will be looking at ways in which basic data can be written to a file using the new file I/O capability. The JDK 1.4 release introduced this new mechanism for file I/O that supersedes the read/write capability provided by readers and writers from the java.io package when applied to file streams. Since the new file I/O does everything that the old capability does, and does it better, we will focus just on that.

In this chapter you will learn:

  • The principles of reading and writing files using the new I/O.

  • How to obtain a file channel for a file.

  • How to create a buffer and load it with data.

  • What view buffers are and how you use them.

  • How you use a channel object to write the contents of a buffer to a file.

Previous Next
JavaScript Editor Java Tutorials Free JavaScript Editor