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

Method fromParts

corpus/java/training/guava/net/HostAndPort.java:132–137  ·  view source on GitHub ↗

Build a HostAndPort instance from separate host and port values. Note: Non-bracketed IPv6 literals are allowed. Use #requireBracketsForIPv6() to prohibit these. @param host the host string to parse. Must not contain a port number. @param port a port number from [0..65535] @return if par

(String host, int port)

Source from the content-addressed store, hash-verified

130 * of range.
131 */
132 public static HostAndPort fromParts(String host, int port) {
133 checkArgument(isValidPort(port), "Port out of range: %s", port);
134 HostAndPort parsedHost = fromString(host);
135 checkArgument(!parsedHost.hasPort(), "Host has a port: %s", host);
136 return new HostAndPort(parsedHost.host, port, parsedHost.hasBracketlessColons);
137 }
138
139 /**
140 * Build a HostAndPort instance from a host only.

Callers

nothing calls this directly

Calls 4

isValidPortMethod · 0.95
fromStringMethod · 0.95
hasPortMethod · 0.95
checkArgumentMethod · 0.45

Tested by

no test coverage detected