Returns the string representation of an {@link InetAddress} suitable for inclusion in a URI. <p>For IPv4 addresses, this is identical to {@link InetAddress#getHostAddress()}, but for IPv6 addresses it compresses zeroes and surrounds the text with square brackets; for example {@code "[2001:db8::1]"}
(InetAddress ip)
| 583 | * @return {@code String} containing URI-safe string literal |
| 584 | */ |
| 585 | public static String toUriString(InetAddress ip) { |
| 586 | if (ip instanceof Inet6Address) { |
| 587 | return "[" + toAddrString(ip) + "]"; |
| 588 | } |
| 589 | return toAddrString(ip); |
| 590 | } |
| 591 | |
| 592 | /** |
| 593 | * Returns an InetAddress representing the literal IPv4 or IPv6 host portion of a URL, encoded in |