Class NetUtils


public final class NetUtils extends Object
Networking-related convenience methods.
  • Method Details

    • getLocalHostname

      public static String getLocalHostname()
      This method gets the network name of the machine we are running on. Returns "UNKNOWN_LOCALHOST" in the unlikely case where the host name cannot be found.
      String the name of the local host
    • getMacAddress

      public static byte[] getMacAddress()
      Returns the local network interface's MAC address if possible. The local network interface is defined here as the NetworkInterface that is both up and not a loopback interface.
      the MAC address of the local network interface or null if no MAC address could be determined.
    • getMacAddressString

      public static String getMacAddressString()
      Returns the mac address, if it is available, as a string with each byte separated by a ":" character.
      the mac address String or null.
    • toURI

      public static URI toURI(String path)
      Converts a URI string or file path to a URI object.
      path - the URI string or path
      the URI object
    • toURIs

      public static List<URI> toURIs(String path)