Java URI to Host Name getHostAndPort(URI u)

Here you can find the source of getHostAndPort(URI u)

Description

get Host And Port

License

Apache License

Declaration

private static String getHostAndPort(URI u) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.URI;

public class Main {
    private static String getHostAndPort(URI u) {
        String host = u.getHost();
        int port = u.getPort();
        return port < 1 ? host : host + ":" + port;
    }/*from   w w  w  .  j av a2 s . c  om*/
}

Related

  1. getHost(URI uri)
  2. getHost(URI uri)
  3. getHost(URI uri)
  4. getHostAddress(final URI uri)
  5. getHostAddress(final URI uri)
  6. getHostFromURI(final URI uri)
  7. getHostUri()