public final class NetUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static Logger |
LOGGER |
private static java.lang.String |
UNKNOWN_LOCALHOST |
Modifier | Constructor and Description |
---|---|
private |
NetUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getLocalHostname()
This method gets the network name of the machine we are running on.
|
static byte[] |
getMacAddress()
Returns the local network interface's MAC address if possible.
|
static java.lang.String |
getMacAddressString()
Returns the mac address, if it is available, as a string with each byte separated by a ":" character.
|
private static boolean |
isUpAndNotLoopback(java.net.NetworkInterface ni) |
static java.net.URI |
toURI(java.lang.String path)
Converts a URI string or file path to a URI object.
|
private static final Logger LOGGER
private static final java.lang.String UNKNOWN_LOCALHOST
public static java.lang.String getLocalHostname()
public static byte[] getMacAddress()
NetworkInterface
that is both up and not a loopback interface.null
if no MAC address could be determined.public static java.lang.String getMacAddressString()
private static boolean isUpAndNotLoopback(java.net.NetworkInterface ni) throws java.net.SocketException
java.net.SocketException
public static java.net.URI toURI(java.lang.String path)
path
- the URI string or path