code: public static String newURI(String scheme, String server, int port, String path, String query) {
          StringBuilder builder = newURIBuilder(scheme, server, port);
          builder.append(path);
          if (query != null && query.length() > 0)
              builder.append('?').append(query);
          return builder.toString();
      }
docs: Create a new URI from the arguments, handling IPv6 host encoding and default ports
  
  @param scheme the URI scheme
  @param server the URI server
  @param port   the URI port
  @param path   the URI path
  @param query  the URI query
  @return A String URI