Java Utililty Methods InetAddress to

List of utility methods to do InetAddress to

Description

The list of methods to do InetAddress to are organized into topic(s).

Method

StringtoIpAddrString(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) {
...
longtoLong(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;
longtoLong(InetAddress ip)
to Long
return toLong(getIP(ip));