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)
| 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. |
nothing calls this directly
no test coverage detected