Java ByteBuffer Copy memcpy(ByteBuffer dstBuffer, int dstByteOffset, ByteBuffer srcBuffer, int srcByteOffset, int length)

Here you can find the source of memcpy(ByteBuffer dstBuffer, int dstByteOffset, ByteBuffer srcBuffer, int srcByteOffset, int length)

Description

memcpy

License

MIT License

Declaration

static void memcpy(ByteBuffer dstBuffer, int dstByteOffset,
            ByteBuffer srcBuffer, int srcByteOffset, int length) 

Method Source Code

//package com.java2s;
// Licensed under the MIT License:

import java.nio.ByteBuffer;

public class Main {
    static void memcpy(ByteBuffer dstBuffer, int dstByteOffset,
            ByteBuffer srcBuffer, int srcByteOffset, int length) {
        ByteBuffer dstDup = dstBuffer.duplicate();
        dstDup.position(dstByteOffset);//from  w  ww  .  j  a v  a  2  s .co  m
        dstDup.limit(dstByteOffset + length);
        ByteBuffer srcDup = srcBuffer.duplicate();
        srcDup.position(srcByteOffset);
        srcDup.limit(srcByteOffset + length);
        dstDup.put(srcDup);
    }
}

Related

  1. deepCopyVisible(ByteBuffer orig)
  2. duplicate(ByteBuffer bb)
  3. duplicate(ByteBuffer buffer)
  4. duplicate(ByteBuffer[] buffers)
  5. duplicate(ByteBuffer[] byteBuffers)