Java ByteBuffer Clone cloneByteBuffer(ByteBuffer buf)

Here you can find the source of cloneByteBuffer(ByteBuffer buf)

Description

clone Byte Buffer

License

Open Source License

Declaration

public static ByteBuffer cloneByteBuffer(ByteBuffer buf) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer cloneByteBuffer(ByteBuffer buf) {
        ByteBuffer ret = ByteBuffer.allocate(buf.limit() - buf.position());
        ret.put(buf);//from   ww w  .j a  va2s .  c om
        ret.flip();
        buf.flip();
        return ret;
    }
}

Related

  1. clone(final ByteBuffer buf)
  2. clone(final ByteBuffer original)
  3. cloneAsDirectByteBuffer(byte[] input, int offset, int len)
  4. cloneBuffer(ByteBuffer pesBuffer)
  5. cloneBufferData(ByteBuffer srcBuffer)
  6. cloneByteBuffer(ByteBuffer buf)
  7. cloneByteBufferList(List source)
  8. cloneByteBufferList(List source)
  9. cloneOnHeap(final ByteBuffer buf)