requestCapacity
Request capacity of the buffer. In case buffer is already larger than the requested, it 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.
Parameters
capacity
new capacity
copyAtEnd
copy current data at the end of new underlying buffer