A Buffer has three properties:
- capacity
- position
- limit
The meaning of position and limit depends on whether the Buffer is in read or write mode.
In write mode the limit of a Buffer is the limit of how much data you can write into the buffer. In write mode the limit is equal to the capacity of the Buffer.
When flipping the Buffer into read mode, limit means the limit of how much data you can read from the data.