Emulate BufferUtils.copy(Buffer, Buffer, numElements)

Replaces #2444