code: public static final Bytes of(ByteBuffer bb) {
      Objects.requireNonNull(bb);
      if (bb.remaining() == 0) {
        return EMPTY;
      }
      byte[] data;
      if (bb.hasArray()) {
        data = Arrays.copyOfRange(bb.array(), bb.position() + bb.arrayOffset(),
            bb.limit() + bb.arrayOffset());
      } else {
        data = new byte[bb.remaining()];
        // duplicate so that it does not change position
        bb.duplicate().get(data);
      }
      return new Bytes(data);
    }
docs: Creates a Bytes object by copying the data of the given ByteBuffer.
  
  @param bb Data will be read from this ByteBuffer in such a way that its position is not
  changed.