public static void copyFromArrayToBuffer(ByteBuffer out, int outOffset, byte[] in, int inOffset,
                                             int length) {
        if (out.hasArray()) {
            System.arraycopy(in, inOffset, out.array(), out.arrayOffset() + outOffset, length);
        } else if (UNSAFE_AVAIL) {
            UnsafeAccess.copy(in, inOffset, out, outOffset, length);
        } else {
            ByteBuffer outDup = out.duplicate();
            outDup.position(outOffset);
            outDup.put(in, inOffset, length);
        }
    }
Copies bytes from given array's offset to length part into the given buffer. Puts the bytes to
buffer's given position. This doesn't affect the position of buffer.

@param out       output bytebuffer to copy to
@param outOffset output buffer offset
@param in        input array to copy from
@param inOffset  input offset to copy from
@param length    the number of bytes to copy
stroom-bytebuffer/src/main/java/stroom/bytebuffer/hbase/ByteBufferUtils.java