O'Reilly logo

Java 7 New Features Cookbook by Jennifer L. Reese, Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Stream IO in Java 7

In this chapter, we will cover:

  • Managing simple files

  • Using buffered IO for files

  • Random access IO using the SeekableByteChannel

  • Managing asynchronous communication using the AsynchronousServerSocketChannel class

  • Writing to a file using the AsynchronousFileChannel class

  • Reading from a file using the AsynchronousFileChannel class

  • Using the SecureDirectoryStream class

Introduction

In Java 7, we found that there are numerous improvements to its IO capabilities. Most of these are found in the java.nio package, which has been dubbed as NIO2. In this chapter, we will focus on the new support for streaming and channel-based IO. A stream is a contiguous sequence of data. Stream IO acts on a single character at a time, while channel ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required