public final String buildAuthority() {
    // scheme, [user info], host, [port]
    StringBuilder buf = new StringBuilder();
    buf.append(Preconditions.checkNotNull(scheme));
    buf.append("://");
    if (userInfo != null) {
      buf.append(CharEscapers.escapeUriUserInfo(userInfo)).append('@');
    }
    buf.append(Preconditions.checkNotNull(host));
    int port = this.port;
    if (port != -1) {
      buf.append(':').append(port);
    }
    return buf.toString();
  }
public final String buildAuthority ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( Preconditions . checkNotNull ( scheme ) ) ; buf . append ( "://" ) ; if ( userInfo != null ) { buf . append ( CharEscapers . escapeUriUserInfo ( userInfo ) ) . append ( '@' ) ; } buf . append ( Preconditions . checkNotNull ( host ) ) ; int port = this . port ; if ( port != - 1 ) { buf . append ( ':' ) . append ( port ) ; } return buf . toString ( ) ; }
Constructs the portion of the URL containing the scheme, host and port.

<p>For the URL {@code "http://example.com/something?action=add"} this method would return
{@code "http://example.com"}.

@return scheme://[user-info@]host[:port]
@since 1.9