public final class IPAddressUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
getLocalHost()
Retrieves the localhost host name.
|
static String |
getLocalHostIPAddress()
Retrieves the localhost IP address.
|
static int |
ipToInt(String ip)
Converts an IP address in the form a.b.c.d to an
int . |
public static int ipToInt(String ip) throws IllegalArgumentException, ParseException
int
.ip
- the IP address, must be in the form:
a.a.a.a., where a is a number between 0 and 255,
with no leading zeroes; cannot be null
.int
.IllegalArgumentException
- if ip == null
.ParseException
- if ip
cannot be parsed as an IP address.public static String getLocalHostIPAddress()
"127.0.0.1"
.public static String getLocalHost()
"localhost"
.See http://www.xins.org/.