code: protected void set(final String protocol, final String host, final int port, final String file,
        final String ref) {
      this.protocol = protocol;
      this.host = host;
      this.authority = port == -1 ? host : host + ":" + port;
      this.port = port;
      this.file = file;
      this.ref = ref;
      /*
       * This is very important. We must recompute this after the URL has been changed.
       */
      this.hashCodeValue = -1;
      final int q = file.lastIndexOf('?');
      if (q == -1) {
        this.path = file;
      } else {
        this.query = file.substring(q + 1);
        this.path = file.substring(0, q);
      }
    }
docs: Sets the fields of the URL. This is not a public method so that only URLStreamHandlers can
  modify URL fields. URLs are otherwise constant.
  
  @param protocol the name of the protocol to use
  @param host the name of the host
  @param port the port number on the host
  @param file the file on the host
  @param ref the internal reference in the URL