/** * Returns true if the string is a valid numeric IPv4 or IPv6 address (such as "192.168.0.1"). * This copes with all forms of address that Java supports, detailed in the {@link InetAddress} * class documentation. * * @hide used by frameworks/base to ensure that a getAllByName won't cause a DNS lookup. */ public static boolean isNumeric(String address) { InetAddress inetAddress = parseNumericAddressNoThrow(address); return inetAddress != null && disallowDeprecatedFormats(address, inetAddress) != null; }
/** * Returns an InetAddress corresponding to the given numeric address (such * as {@code "192.168.0.1"} or {@code "2001:4860:800d::68"}). * This method will never do a DNS lookup. Non-numeric addresses are errors. * * @hide used by frameworks/base's NetworkUtils.numericToInetAddress * @throws IllegalArgumentException if {@code numericAddress} is not a numeric address */ public static InetAddress parseNumericAddress(String numericAddress) { if (numericAddress == null || numericAddress.isEmpty()) { return Inet6Address.LOOPBACK; } InetAddress result = parseNumericAddressNoThrow(numericAddress); result = disallowDeprecatedFormats(numericAddress, result); if (result == null) { throw new IllegalArgumentException("Not a numeric address: " + numericAddress); } return result; }
/** * Returns the InetAddresses for {@code host}. The returned array is shared * and must be cloned before it is returned to application code. */ private static InetAddress[] getAllByNameImpl(String host) throws UnknownHostException { if (host == null || host.isEmpty()) { return loopbackAddresses(); } // Is it a numeric address? InetAddress result = parseNumericAddressNoThrow(host); if (result != null) { result = disallowDeprecatedFormats(host, result); if (result == null) { throw new UnknownHostException("Deprecated IPv4 address format: " + host); } return new InetAddress[] { result }; } return lookupHostByName(host).clone(); }
/** * Returns true if the string is a valid numeric IPv4 or IPv6 address (such as "192.168.0.1"). * This copes with all forms of address that Java supports, detailed in the {@link InetAddress} * class documentation. * * @hide used by frameworks/base to ensure that a getAllByName won't cause a DNS lookup. */ public static boolean isNumeric(String address) { InetAddress inetAddress = parseNumericAddressNoThrow(address); return inetAddress != null && disallowDeprecatedFormats(address, inetAddress) != null; }
/** * Returns true if the string is a valid numeric IPv4 or IPv6 address (such as "192.168.0.1"). * This copes with all forms of address that Java supports, detailed in the {@link InetAddress} * class documentation. * * @hide used by frameworks/base to ensure that a getAllByName won't cause a DNS lookup. */ public static boolean isNumeric(String address) { InetAddress inetAddress = parseNumericAddressNoThrow(address); return inetAddress != null && disallowDeprecatedFormats(address, inetAddress) != null; }
/** * Returns true if the string is a valid numeric IPv4 or IPv6 address (such as "192.168.0.1"). * This copes with all forms of address that Java supports, detailed in the {@link InetAddress} * class documentation. * * @hide used by frameworks/base to ensure that a getAllByName won't cause a DNS lookup. */ public static boolean isNumeric(String address) { InetAddress inetAddress = parseNumericAddressNoThrow(address); return inetAddress != null && disallowDeprecatedFormats(address, inetAddress) != null; }
/** * Returns true if the string is a valid numeric IPv4 or IPv6 address (such as "192.168.0.1"). * This copes with all forms of address that Java supports, detailed in the {@link InetAddress} * class documentation. * * @hide used by frameworks/base to ensure that a getAllByName won't cause a DNS lookup. */ public static boolean isNumeric(String address) { InetAddress inetAddress = parseNumericAddressNoThrow(address); return inetAddress != null && disallowDeprecatedFormats(address, inetAddress) != null; }
/** * Returns true if the string is a valid numeric IPv4 or IPv6 address (such as "192.168.0.1"). * This copes with all forms of address that Java supports, detailed in the {@link InetAddress} * class documentation. * * @hide used by frameworks/base to ensure that a getAllByName won't cause a DNS lookup. */ public static boolean isNumeric(String address) { InetAddress inetAddress = parseNumericAddressNoThrow(address); return inetAddress != null && disallowDeprecatedFormats(address, inetAddress) != null; }
/** * Returns true if the string is a valid numeric IPv4 or IPv6 address (such as "192.168.0.1"). * This copes with all forms of address that Java supports, detailed in the {@link InetAddress} * class documentation. * * @hide used by frameworks/base to ensure that a getAllByName won't cause a DNS lookup. */ public static boolean isNumeric(String address) { InetAddress inetAddress = parseNumericAddressNoThrow(address); return inetAddress != null && disallowDeprecatedFormats(address, inetAddress) != null; }
/** * Returns an InetAddress corresponding to the given numeric address (such * as {@code "192.168.0.1"} or {@code "2001:4860:800d::68"}). * This method will never do a DNS lookup. Non-numeric addresses are errors. * * @hide used by frameworks/base's NetworkUtils.numericToInetAddress * @throws IllegalArgumentException if {@code numericAddress} is not a numeric address */ public static InetAddress parseNumericAddress(String numericAddress) { if (numericAddress == null || numericAddress.isEmpty()) { return Inet6Address.LOOPBACK; } InetAddress result = parseNumericAddressNoThrow(numericAddress); result = disallowDeprecatedFormats(numericAddress, result); if (result == null) { throw new IllegalArgumentException("Not a numeric address: " + numericAddress); } return result; }
/** * Returns an InetAddress corresponding to the given numeric address (such * as {@code "192.168.0.1"} or {@code "2001:4860:800d::68"}). * This method will never do a DNS lookup. Non-numeric addresses are errors. * * @hide used by frameworks/base's NetworkUtils.numericToInetAddress * @throws IllegalArgumentException if {@code numericAddress} is not a numeric address */ public static InetAddress parseNumericAddress(String numericAddress) { if (numericAddress == null || numericAddress.isEmpty()) { return Inet6Address.LOOPBACK; } InetAddress result = parseNumericAddressNoThrow(numericAddress); result = disallowDeprecatedFormats(numericAddress, result); if (result == null) { throw new IllegalArgumentException("Not a numeric address: " + numericAddress); } return result; }
/** * Returns an InetAddress corresponding to the given numeric address (such * as {@code "192.168.0.1"} or {@code "2001:4860:800d::68"}). * This method will never do a DNS lookup. Non-numeric addresses are errors. * * @hide used by frameworks/base's NetworkUtils.numericToInetAddress * @throws IllegalArgumentException if {@code numericAddress} is not a numeric address */ public static InetAddress parseNumericAddress(String numericAddress) { if (numericAddress == null || numericAddress.isEmpty()) { return Inet6Address.LOOPBACK; } InetAddress result = parseNumericAddressNoThrow(numericAddress); result = disallowDeprecatedFormats(numericAddress, result); if (result == null) { throw new IllegalArgumentException("Not a numeric address: " + numericAddress); } return result; }
/** * Returns an InetAddress corresponding to the given numeric address (such * as {@code "192.168.0.1"} or {@code "2001:4860:800d::68"}). * This method will never do a DNS lookup. Non-numeric addresses are errors. * * @hide used by frameworks/base's NetworkUtils.numericToInetAddress * @throws IllegalArgumentException if {@code numericAddress} is not a numeric address */ public static InetAddress parseNumericAddress(String numericAddress) { if (numericAddress == null || numericAddress.isEmpty()) { return Inet6Address.LOOPBACK; } InetAddress result = parseNumericAddressNoThrow(numericAddress); result = disallowDeprecatedFormats(numericAddress, result); if (result == null) { throw new IllegalArgumentException("Not a numeric address: " + numericAddress); } return result; }
/** * Returns an InetAddress corresponding to the given numeric address (such * as {@code "192.168.0.1"} or {@code "2001:4860:800d::68"}). * This method will never do a DNS lookup. Non-numeric addresses are errors. * * @hide used by frameworks/base's NetworkUtils.numericToInetAddress * @throws IllegalArgumentException if {@code numericAddress} is not a numeric address */ public static InetAddress parseNumericAddress(String numericAddress) { if (numericAddress == null || numericAddress.isEmpty()) { return Inet6Address.LOOPBACK; } InetAddress result = parseNumericAddressNoThrow(numericAddress); result = disallowDeprecatedFormats(numericAddress, result); if (result == null) { throw new IllegalArgumentException("Not a numeric address: " + numericAddress); } return result; }
/** * Returns the InetAddresses for {@code host}. The returned array is shared * and must be cloned before it is returned to application code. */ private static InetAddress[] getAllByNameImpl(String host) throws UnknownHostException { if (host == null || host.isEmpty()) { return loopbackAddresses(); } // Is it a numeric address? InetAddress result = parseNumericAddressNoThrow(host); if (result != null) { result = disallowDeprecatedFormats(host, result); if (result == null) { throw new UnknownHostException("Deprecated IPv4 address format: " + host); } return new InetAddress[] { result }; } return lookupHostByName(host).clone(); }
/** * Returns the InetAddresses for {@code host}. The returned array is shared * and must be cloned before it is returned to application code. */ private static InetAddress[] getAllByNameImpl(String host) throws UnknownHostException { if (host == null || host.isEmpty()) { return loopbackAddresses(); } // Is it a numeric address? InetAddress result = parseNumericAddressNoThrow(host); if (result != null) { result = disallowDeprecatedFormats(host, result); if (result == null) { throw new UnknownHostException("Deprecated IPv4 address format: " + host); } return new InetAddress[] { result }; } return lookupHostByName(host).clone(); }
/** * Returns the InetAddresses for {@code host}. The returned array is shared * and must be cloned before it is returned to application code. */ private static InetAddress[] getAllByNameImpl(String host) throws UnknownHostException { if (host == null || host.isEmpty()) { return loopbackAddresses(); } // Is it a numeric address? InetAddress result = parseNumericAddressNoThrow(host); if (result != null) { result = disallowDeprecatedFormats(host, result); if (result == null) { throw new UnknownHostException("Deprecated IPv4 address format: " + host); } return new InetAddress[] { result }; } return lookupHostByName(host).clone(); }
/** * Returns the InetAddresses for {@code host}. The returned array is shared * and must be cloned before it is returned to application code. */ private static InetAddress[] getAllByNameImpl(String host) throws UnknownHostException { if (host == null || host.isEmpty()) { return loopbackAddresses(); } // Is it a numeric address? InetAddress result = parseNumericAddressNoThrow(host); if (result != null) { result = disallowDeprecatedFormats(host, result); if (result == null) { throw new UnknownHostException("Deprecated IPv4 address format: " + host); } return new InetAddress[] { result }; } return lookupHostByName(host).clone(); }
/** * Returns the InetAddresses for {@code host}. The returned array is shared * and must be cloned before it is returned to application code. */ private static InetAddress[] getAllByNameImpl(String host) throws UnknownHostException { if (host == null || host.isEmpty()) { return loopbackAddresses(); } // Is it a numeric address? InetAddress result = parseNumericAddressNoThrow(host); if (result != null) { result = disallowDeprecatedFormats(host, result); if (result == null) { throw new UnknownHostException("Deprecated IPv4 address format: " + host); } return new InetAddress[] { result }; } return lookupHostByName(host).clone(); }
/** * Returns the InetAddresses for {@code host}. The returned array is shared * and must be cloned before it is returned to application code. */ private static InetAddress[] getAllByNameImpl(String host) throws UnknownHostException { if (host == null || host.isEmpty()) { return loopbackAddresses(); } // Is it a numeric address? InetAddress result = parseNumericAddressNoThrow(host); if (result != null) { result = disallowDeprecatedFormats(host, result); if (result == null) { throw new UnknownHostException("Deprecated IPv4 address format: " + host); } return new InetAddress[] { result }; } return lookupHostByName(host).clone(); }