requestCapacity

abstract fun requestCapacity(capacity: Int, copyAtEnd: Boolean = false): Int

Request capacity of the buffer in absolute values. In case buffer is already larger than the requested the method is a no-op. Otherwise, It might try to resize the buffer. In case of being unable to allocate enough memory, an exception will be thrown.

Return

new capacity in bytes

Parameters

capacity

new capacity

copyAtEnd

copy current data at the end of new underlying buffer