public class NetUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatHostAddress(java.net.SocketAddress address)
Return a string representation of a
SocketAddress . |
static java.lang.String |
getLocalHostName()
Gets the name of the local host.
|
static java.util.Set<java.net.InetAddress> |
getLocalInterfaces()
Retrieve the set of
InetAddress 's to which the current host responds. |
static java.net.InetAddress |
getLoopbackAddress()
Return the local host's loopback address.
|
static int |
hostToNetworkOrder(int host) |
static short |
hostToNetworkOrder(short host) |
static java.net.InetAddress |
iPAddressFromUInt(int ipAddr) |
static int |
iPAddressToUInt(java.net.InetAddress ipAddress) |
static int |
networkToHostOrder(int network) |
static short |
networkToHostOrder(short network) |
public static java.util.Set<java.net.InetAddress> getLocalInterfaces()
InetAddress
's to which the current host responds.InetAddress
's to which the current host responds.public static java.lang.String getLocalHostName()
public static java.net.InetAddress getLoopbackAddress()
public static java.lang.String formatHostAddress(java.net.SocketAddress address)
Return a string representation of a SocketAddress
.
address
- the address to formataddress
.public static short networkToHostOrder(short network)
public static int iPAddressToUInt(java.net.InetAddress ipAddress)
public static java.net.InetAddress iPAddressFromUInt(int ipAddr) throws java.net.UnknownHostException
java.net.UnknownHostException
public static int networkToHostOrder(int network)
public static short hostToNetworkOrder(short host)
public static int hostToNetworkOrder(int host)