O'Reilly logo

Java I/O, NIO and NIO.2 by Jeff Friesen

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

Buffers

NIO is based on buffers, whose contents are sent to or received from I/O services via channels. This chapter introduces you to NIO’s buffer classes.

Introducing Buffers

A buffer is an object that stores a fixed amount of data to be sent to or received from an I/O service (an operating system component for performing input/output). It sits between an application and a channel that writes the buffered data to the service or reads the data from the service and deposits it into the buffer.

Buffers possess four properties:

  • Capacity: The total number of data items that can be stored in the buffer. The capacity is specified when the buffer is created and cannot be changed later.
  • Limit: The zero-based index of the first element that ...

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