Java ByteBuffer Copy duplicate(ByteBuffer bb)

Here you can find the source of duplicate(ByteBuffer bb)

Description

duplicate

License

BSD License

Declaration

public static ByteBuffer duplicate(ByteBuffer bb) 

Method Source Code

//package com.java2s;
/**//w w w  .  j a va  2  s .  c  om
 * This class is part of JCodec ( www.jcodec.org ) This software is distributed
 * under FreeBSD License
 * 
 * @author The JCodec project
 * 
 */

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer duplicate(ByteBuffer bb) {
        ByteBuffer out = ByteBuffer.allocate(bb.remaining());
        out.put(bb.duplicate());
        out.flip();
        return out;
    }
}

Related

  1. copyToStream(ByteBuffer byteBuffer, OutputStream os)
  2. copyWholeFrame(ByteBuffer srcFrame, ByteBuffer destFrame)
  3. deepCopy(ByteBuffer orig)
  4. deepCopyByteBufferToByteArray(ByteBuffer byteBuffer)
  5. deepCopyVisible(ByteBuffer orig)
  6. duplicate(ByteBuffer buffer)
  7. duplicate(ByteBuffer[] buffers)
  8. duplicate(ByteBuffer[] byteBuffers)
  9. memcpy(ByteBuffer dstBuffer, int dstByteOffset, ByteBuffer srcBuffer, int srcByteOffset, int length)