Android ByteBuffer Copy clone(ByteBuffer original)

Here you can find the source of clone(ByteBuffer original)

Description

clone

License

Open Source License

Declaration

public static ByteBuffer clone(ByteBuffer original) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer clone(ByteBuffer original) {
        ByteBuffer clone = ByteBuffer.allocate(original.capacity());
        original.rewind();//from w w w. jav a  2  s. c  om
        clone.put(original);
        original.rewind();
        clone.flip();
        return clone;
    }
}

Related

  1. copyByteBuffer(ByteBuffer paramByteBuffer)
  2. copyFromBufferToBuffer(ByteBuffer out, ByteBuffer in, int sourceOffset, int length)