private static int getRelativeOffsetForByteBuff(ByteBuff byteBuff, int globalOffset,
    int itemIndex) {
    if (byteBuff instanceof SingleByteBuff) {
      if (itemIndex != 0) {
        throw new IndexOutOfBoundsException("index:[" + itemIndex + "],but only index 0 is valid.");
      }
      return globalOffset;
    }
    return ((MultiByteBuff) byteBuff).getRelativeOffset(globalOffset, itemIndex);
  }
Copies from a src BB to this MBB. This will be absolute positional copying and won't affect the
position of any of the buffers.
@param destOffset the position in this MBB to which the copy should happen
@param src        the src MBB
@param srcOffset  the offset in the src MBB from where the elements should be read
@param length     the length upto which the copy should happen
@throws BufferUnderflowException If there are fewer than length bytes remaining in src
                                 ByteBuff.
@throws BufferOverflowException  If there is insufficient available space in this MBB for
                                 length bytes.
hbase-common/src/main/java/org/apache/hadoop/hbase/nio/MultiByteBuff.java