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

Method forString

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

Returns the InetAddress having the given string representation. This deliberately avoids all nameservice lookups (e.g. no DNS). @param ipString String containing an IPv4 or IPv6 string literal, e.g. "192.168.0.1" or "2001:db8::1" @return InetAddress r

(String ipString)

Source from the content-addressed store, hash-verified

137 * @throws IllegalArgumentException if the argument is not a valid IP string literal
138 */
139 public static InetAddress forString(String ipString) {
140 byte[] addr = ipStringToBytes(ipString);
141
142 // The argument was malformed, i.e. not an IP string literal.
143 if (addr == null) {
144 throw formatIllegalArgumentException("'%s' is not an IP string literal.", ipString);
145 }
146
147 return bytesToInetAddress(addr);
148 }
149
150 /**
151 * Returns {@code true} if the supplied string is a valid IP string literal, {@code false}

Callers 2

InetAddressesClass · 0.95
fromValidMethod · 0.95

Calls 3

ipStringToBytesMethod · 0.95
bytesToInetAddressMethod · 0.95

Tested by

no test coverage detected