add method and test

This commit is contained in:
Looly
2020-05-12 00:37:42 +08:00
parent fa936f4742
commit 0a9b9a6fce
4 changed files with 42 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import oshi.hardware.ComputerSystem;
import oshi.hardware.GlobalMemory;
import oshi.hardware.HWDiskStore;
import oshi.hardware.HardwareAbstractionLayer;
import oshi.hardware.NetworkIF;
import oshi.hardware.Sensors;
import oshi.software.os.OperatingSystem;
@@ -98,4 +99,15 @@ public class OshiUtil {
public static HWDiskStore[] getDiskStores() {
return hardware.getDiskStores();
}
/**
* 获取网络相关信息,可能多块网卡
* @return 网络相关信息
* @since 5.3.5
*/
public static NetworkIF[] getNetworkIFs(){
return hardware.getNetworkIFs();
}
}