List of utility methods to do InetAddress to
String | toIpAddrString(final InetAddress addr) toIpAddrString if (addr == null) { throw new IllegalArgumentException("Cannot convert null InetAddress to a string"); } else { final byte[] address = addr.getAddress(); if (address == null) { throw new IllegalArgumentException( "InetAddress instance violates contract by returning a null address from getAddress()"); } else if (addr instanceof Inet4Address) { ... |
long | toLong(InetAddress addr) Converts the internet address to a long value so that it can be compared using simple opertions. byte[] baddr = addr.getAddress(); long result = ((long) baddr[0] & 0xffL) << 24 | ((long) baddr[1] & 0xffL) << 16 | ((long) baddr[2] & 0xffL) << 8 | ((long) baddr[3] & 0xffL); return result; |
long | toLong(InetAddress ip) to Long return toLong(getIP(ip));
|