Brief Overview of ByteBuffer - Java File Path IO

Java examples for File Path IO:ByteBuffer

Introduction

A buffer is essentially an array that holds some data to be written or that was just read.

ByteBuffer Properties

The following are the essential properties of a buffer:

  • Limit: When writing from a buffer, the limit specifies how much data remains to get. When you are reading into a buffer, the limit specifies how much room remains to put data into.
  • Position: keeps track of how much data you have read or written.
  • Capacity: specifies the maximum amount of data that can be stored in a buffer. The limit can never be larger than the capacity.

ByteBuffer provides a set of get() and put() methods for accessing data.


Related Tutorials