Java Utililty Methods ByteBuffer Clone

List of utility methods to do ByteBuffer Clone

Description

The list of methods to do ByteBuffer Clone are organized into topic(s).

Method

ByteBuffercloneOnHeap(final ByteBuffer buf)
clone On Heap
if (buf == null) {
    return null;
buf.rewind();
final ByteBuffer copy = createByteBufferOnHeap(buf.limit());
copy.put(buf);
return copy;
ByteBuffercloneSection(ByteBuffer source, int start, int count)
clone Section
int oldPosition = source.position();
source.position(start);
ByteBuffer result = source.slice();
result.order(source.order());
result.limit(count);
source.position(oldPosition);
return result;