Android Utililty Methods ByteBuffer Copy

List of utility methods to do ByteBuffer Copy

Description

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

Method

ByteBuffercopyByteBuffer(ByteBuffer paramByteBuffer)
copy Byte Buffer
ByteBuffer localByteBuffer = newByteBuffer(paramByteBuffer
        .remaining());
paramByteBuffer.mark();
localByteBuffer.put(paramByteBuffer);
paramByteBuffer.reset();
localByteBuffer.rewind();
return localByteBuffer;
ByteBufferclone(ByteBuffer original)
clone
ByteBuffer clone = ByteBuffer.allocate(original.capacity());
original.rewind();
clone.put(original);
original.rewind();
clone.flip();
return clone;
voidcopyFromBufferToBuffer(ByteBuffer out, ByteBuffer in, int sourceOffset, int length)
Copy from one buffer to another from given offset
if (in.hasArray() && out.hasArray()) {
    System.arraycopy(in.array(), sourceOffset + in.arrayOffset(),
            out.array(), out.position() + out.arrayOffset(), length);
    skip(out, length);
} else {
    for (int i = 0; i < length; ++i) {
        out.put(in.get(sourceOffset + i));