Exemplo n.º 1
0
  // For non-array versions : beware of overlaps.
  public static final void bbcopy(ByteBuffer bb, int src, int dst, int length, int slotLen) {
    if (src == dst) return;

    if (allowArray && bb.hasArray()) {
      acopyArray(bb, src, dst, length, slotLen);
      return;
    }

    if (src < dst) bbcopy1(bb, src, dst, length, slotLen);
    else bbcopy2(bb, src, dst, length, slotLen);
  }
Exemplo n.º 2
0
  public static final void bbcopy(
      ByteBuffer bb1, int src, ByteBuffer bb2, int dst, int length, int slotLen) {
    // Assume bb1 and bb2 are different and do not overlap.
    if (allowArray && bb1.hasArray() && bb2.hasArray()) {
      acopyArray(bb1, src, bb2, dst, length, slotLen);
      return;
    }
    // One or both does not have an array.

    int bSrc = src * slotLen;
    int bDst = dst * slotLen;
    int bLen = length * slotLen;

    for (int i = 0; i < bLen; i++) bb2.put(bDst + i, bb1.get(bSrc + i));
  }