MCPcopy Create free account
hub / github.com/antlr/codebuff / toUriString

Method toUriString

corpus/java/training/guava/net/InetAddresses.java:436–441  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

434 * @return {@code String} containing URI-safe string literal
435 */
436 public static String toUriString(InetAddress ip) {
437 if (ip instanceof Inet6Address) {
438 return "[" + toAddrString(ip) + "]";
439 }
440 return toAddrString(ip);
441 }
442
443 /**
444 * Returns an InetAddress representing the literal IPv4 or IPv6 host portion of a URL, encoded in

Callers 1

fromValidMethod · 0.95

Calls 1

toAddrStringMethod · 0.95

Tested by

no test coverage detected