-
Notifications
You must be signed in to change notification settings - Fork 1
Properties
A ByteBuffer's capacity is the number of bytes it can store. It's set at creation, cannot be negative and cannot be changed. It can be retrieved with the #capacity
method.
The position is the index of the next element that will be written or read. It's never negative and never greater than the capacity or the limit. It can be retrieved with the #position
method and set with the #position=
method. It starts at 0.
The limit is the index from which no data can be read or written. It can be retrieved with the #limit
method and set with the #limit=
method. It's never negative and starts with the same value as the capacity.
A ByteBuffer's mark is a way to bookmark a position. A new ByteBuffer has no mark, and is set to the current position with the #mark
method. It's never greater than the position and is never negative. The #reset
method sets the position of the buffer to the position it had when #mark
was called.