List of utility methods to do InetAddress Check
boolean | isValidIntranetAddress(InetAddress address) is Valid Intranet Address if (address == null || address.isLoopbackAddress()) return false; String name = address.getHostAddress(); return (name != null && !ANYHOST.equals(name) && !LOCALHOST.equals(name) && IP_PATTERN.matcher(name).matches() && IP_INTRANET_PATTERN.matcher(name).matches()); |
boolean | isValidIpAddress(InetAddress ip) Determine if IP address is valid for BUG to use for event notification. if (ip instanceof Inet6Address) { return false; if (ip.getAddress()[0] == 127) { return false; return true; |
boolean | isWindowsAutoConfiguredIPv4Address(InetAddress add) Determines whether the address is the result of windows auto configuration. return (add.getAddress()[0] & 0xFF) == 169 && (add.getAddress()[1] & 0xFF) == 254;
|
void | sortAddresses(List sort Addresses Collections.sort(addressList, new Comparator<InetAddress>() { @Override public int compare(InetAddress o1, InetAddress o2) { return compareBytes(o1.getAddress(), o2.getAddress()); }); |