Android Utililty Methods ByteBuffer Grow

List of utility methods to do ByteBuffer Grow

Description

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

Method

ByteBuffergrowBuffer(ByteBuffer b, int newCapacity)
Grow a byte buffer, so it has a minimal capacity or at least the double capacity of the original buffer
b.limit(b.position());
b.rewind();
int c2 = b.capacity() * 2;
ByteBuffer on = ByteBuffer.allocate(c2 < newCapacity ? newCapacity
        : c2);
on.put(b);
return on;
voidextendLimit(ByteBuffer buffer, int numBytes)
extend Limit
buffer.limit(buffer.limit() + numBytes);