Returns the string representation of an InetAddress suitable for inclusion in a URI. For IPv4 addresses, this is identical to InetAddress#getHostAddress(), but for IPv6 addresses it compresses zeroes and surrounds the text with square brackets; for example "[2001:db8::1]"
(InetAddress ip)
| 446 | |
| 447 | |
| 448 | public static String toUriString(InetAddress ip) { |
| 449 | if (ip instanceof Inet6Address) { |
| 450 | return "[" + toAddrString(ip) + "]"; |
| 451 | } |
| 452 | return toAddrString(ip); |
| 453 | } |
| 454 | |
| 455 | /** |
| 456 | * Returns an InetAddress representing the literal IPv4 or IPv6 host portion of a URL, encoded in |