This method is often used in conjunction with the {@link Buffer#compact compact} method when transferring data fromone place to another.
395396397398399400401402403404405
static Buffer copy(final MemoryManager memoryManager, final Buffer buffer) { final Buffer tmpBuf = memoryManager.allocate(buffer.remaining()); tmpBuf.put(buffer); return tmpBuf.flip(); } static Buffer move(final MemoryManager memoryManager, final Buffer buffer) {
123124125126127128129130131132133
int size = underlyingInput.size(); chunkBuffer = memoryManager.allocate(size); while (size-- >= 0) { chunkBuffer.put(underlyingInput.read()); } chunkBuffer.flip(); } if (hasSavedBuffer) { savedBuffer.append(chunkBuffer); } else {