public class NetworkUtils extends Object
Constructor and Description |
---|
NetworkUtils() |
Modifier and Type | Method and Description |
---|---|
static InetAddress |
getLocalHost()
Many Linux systems typically return 127.0.0.1 as the localhost address
instead of the address assigned on the local network.
|
static Collection<InetAddress> |
getNetworkInterfaces()
Utility method for accessing public interfaces.
|
static boolean |
isPublicAddress()
Returns whether or not this host is on the public Internet.
|
static boolean |
isPublicAddress(InetAddress ia)
Returns whether or not the specified address represents an address on
the public Internet.
|
public static InetAddress getLocalHost() throws UnknownHostException
UnknownHostException
- If the host is considered unknown for
any reason.public static boolean isPublicAddress(InetAddress ia)
ia
- The address to check.true
if the address is an address on the public
Internet, otherwise false
.public static boolean isPublicAddress()
true
if this host is on the public Internet,
otherwise false
.public static Collection<InetAddress> getNetworkInterfaces() throws SocketException
Collection
of public interfaces.SocketException
- If there's a socket error accessing the
interfaces.Copyright © 2009–2013 LittleShoot. All rights reserved.