List of utility methods to do Network Interface Get
NetworkInterface | getInterfaceByName(String interfaceName) get Interface By Name Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netIf : Collections.list(nets)) { if (netIf.getName().equalsIgnoreCase(interfaceName)) { return netIf; } else { Enumeration<NetworkInterface> subIfs = netIf.getSubInterfaces(); for (NetworkInterface subIf : Collections.list(subIfs)) { if (subIf.getName().equalsIgnoreCase(interfaceName)) { ... |
String | getInterfaceDiagnostic() It provides a complete description of all available network interfaces in the system as well as the configured INET Addresses. StringBuilder description = new StringBuilder(); Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netIf : Collections.list(nets)) { description.append(describeInterface(netIf, false)); description.append(displaySubInterfaces(netIf)); description.append("\n"); return description.toString(); ... |
String | getInterfaceInfo(NetworkInterface nif) get Interface Info return getInterfaceInfo(nif, ":"); |
Map | getInterfaces() get Interfaces Map<String, String> interfaces = new HashMap<String, String>(); try { Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { NetworkInterface ni = (NetworkInterface) e.nextElement(); String nameInterface = ni.getName(); Enumeration<InetAddress> e2 = ni.getInetAddresses(); while (e2.hasMoreElements()) { ... |
List | getInterfaces() Return all interfaces (and subinterfaces) on the system List<NetworkInterface> all = new ArrayList<NetworkInterface>(); addAllInterfaces(all, Collections.list(NetworkInterface.getNetworkInterfaces())); return all; |
List | getInterfaces() get Interfaces List<InterfaceAddress> result = new ArrayList<InterfaceAddress>(); try { Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); while (en.hasMoreElements()) { NetworkInterface ni = (NetworkInterface) en.nextElement(); for (InterfaceAddress address : ni.getInterfaceAddresses()) { if (!address.getAddress().getHostAddress().contains(":") && !address.getAddress().getHostAddress().contains("127.0.0.1")) ... |
List | getInterfaces() get Interfaces Enumeration<NetworkInterface> intfs = NetworkInterface.getNetworkInterfaces(); List<NetworkInterface> intfsList = new ArrayList<NetworkInterface>(); while (intfs.hasMoreElements()) { intfsList.add((NetworkInterface) intfs.nextElement()); return intfsList; |
List | getInterfaces() This method returns a List of Network Interfaces on the computer. Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
return Collections.list(nets);
|
Enumeration | getInterfaces(final String interfaceName) get Interfaces return interfaceName != null ? new Vector<NetworkInterface>(Arrays.asList(NetworkInterface.getByName(interfaceName))).elements() : NetworkInterface.getNetworkInterfaces(); |
byte[] | getKey() get Key Enumeration<NetworkInterface> ni = java.net.NetworkInterface.getNetworkInterfaces(); if (ni.hasMoreElements()) { byte[] mac = ni.nextElement().getHardwareAddress(); if (mac != null) { return Arrays.copyOf(mac, 8); } else { return "aGorRiaA".getBytes(); } else { return "aGorRiaA".getBytes(); |