code: @Nonnull
    public ByteBuffer getByteBuffer() {
      if (base instanceof byte[] && offset >= BYTE_ARRAY_OFFSET) {
        final byte[] bytes = (byte[]) base;
  
        // the offset includes an object header... this is only needed for unsafe copies
        final long arrayOffset = offset - BYTE_ARRAY_OFFSET;
  
        // verify that the offset and length points somewhere inside the byte array
        // and that the offset can safely be truncated to a 32-bit integer
        if ((long) bytes.length < arrayOffset + numBytes) {
          throw new ArrayIndexOutOfBoundsException();
        }
  
        return ByteBuffer.wrap(bytes, (int) arrayOffset, numBytes);
      } else {
        return ByteBuffer.wrap(getBytes());
      }
    }
docs: Returns a {@link ByteBuffer} wrapping the base object if it is a byte array
  or a copy of the data if the base object is not a byte array.
  
  Unlike getBytes this will not create a copy the array if this is a slice.