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.
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 ...