limit

fun limit(newLimit: Int): ByteBuffer

Sets this buffer's limit.

If the current position is greater than the new limit, the position is set to the new limit. If the mark is defined (i.e. mark != -1) and is greater than the new limit, it is discarded.

Return

this ByteBuffer.

Parameters

newLimit

the new limit (in int); must be non-negative and no larger than capacity.

Throws

if newLimit is negative or greater than capacity.


var limit: Int

The limit, i.e. the upper bound (exclusive) for read/writes.