ktor-utils / io.ktor.util / java.nio.ByteBuffer / copy

copy

fun ByteBuffer.copy(size: Int = remaining()): ByteBuffer

Moves all bytes in this buffer to a newly created buffer with the optionally specified size

fun ByteBuffer.copy(pool: ObjectPool<ByteBuffer>, size: Int = remaining()): ByteBuffer

Moves all bytes in this buffer to a newly created buffer with the optionally specified size by allocating it from the given pool