Class NetUtils


  • public class NetUtils
    extends java.lang.Object
    • Field Detail

      • current_check_millis

        private static int current_check_millis
      • last_ni_check

        private static long last_ni_check
      • current_interfaces

        private static volatile java.util.List<java.net.NetworkInterface> current_interfaces
      • first_check

        private static boolean first_check
      • check_in_progress

        private static boolean check_in_progress
      • host_or_address_map

        private static final java.util.Map<java.lang.Object,​java.lang.Object[]> host_or_address_map
      • RESULT_NULL

        private static final java.lang.Object RESULT_NULL
    • Constructor Detail

      • NetUtils

        public NetUtils()
    • Method Detail

      • getNetworkInterfaces

        public static java.util.List<java.net.NetworkInterface> getNetworkInterfaces()
                                                                              throws java.net.SocketException
        Throws:
        java.net.SocketException
      • getLocalHost

        public static java.net.InetAddress getLocalHost()
                                                 throws java.net.UnknownHostException
        Throws:
        java.net.UnknownHostException
      • getByName

        public static java.net.NetworkInterface getByName​(java.lang.String name)
                                                   throws java.net.SocketException
        Throws:
        java.net.SocketException
      • getByInetAddress

        public static java.net.NetworkInterface getByInetAddress​(java.net.InetAddress addr)
                                                          throws java.net.SocketException
        Throws:
        java.net.SocketException
      • getBySupport

        private static java.net.NetworkInterface getBySupport​(java.lang.Object name_or_address)
                                                       throws java.net.SocketException
        Throws:
        java.net.SocketException
      • NetworkInterface_getNetworkInterfaces

        private static java.util.Enumeration<java.net.NetworkInterface> NetworkInterface_getNetworkInterfaces()
                                                                                                       throws java.net.SocketException
        Calls NetworkInterface.getNetworkInterface, tries to recover from SocketException on some Android devices
        Throws:
        java.net.SocketException