Java URI to Host Name getHostFromURI(final URI uri)

Here you can find the source of getHostFromURI(final URI uri)

Description

Get the host (if available) from a URI.

License

BSD License

Parameter

Parameter Description
uri the URI

Return

with the host, or null if not available.

Declaration

public static String getHostFromURI(final URI uri) 

Method Source Code

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

import java.net.URI;

public class Main {
    /**/*  www.j  a  va  2  s  . c  o  m*/
     * Get the host (if available) from a URI.
     *
     * @param uri
     *            the URI
     * @return {@link String} with the host, or <code>null</code> if not
     *         available.
     */
    public static String getHostFromURI(final URI uri) {
        return uri.getHost();
    }
}

Related

  1. getHost(URI uri)
  2. getHost(URI uri)
  3. getHostAddress(final URI uri)
  4. getHostAddress(final URI uri)
  5. getHostAndPort(URI u)
  6. getHostUri()