requestAdditionalCapacity

open fun requestAdditionalCapacity(additional: Int, copyAtEnd: Boolean = false): Int

Request capacity of the buffer relative to writePosition. In case buffer is already larger than the requested, this method will just return true. 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

additional

capacity in bytes to be added on top of writePosition

copyAtEnd

copy current data at the end of new underlying buffer