Class SystemInfoUtil

java.lang.Object
com.luna.common.os.SystemInfoUtil

public class SystemInfoUtil extends Object
获取当前系统信息
Author:
luna
  • Constructor Details

    • SystemInfoUtil

      public SystemInfoUtil()
  • Method Details

    • getProcesses

      public static List<oshi.software.os.OSProcess> getProcesses()
      获取所有进程
      Returns:
    • getLocalHost

      public static InetAddress getLocalHost()
    • getIP

      @Deprecated public static String getIP()
      Deprecated.
      本地IP 有可能拿到回环网卡
      Returns:
      IP地址
    • getIpv4

      public static String getIpv4()
    • getAllIpv4

      public static List<String> getAllIpv4()
      本级ip 过滤 回环地址、链路本地地址或多播地址
      Returns:
    • getNoLoopbackIP

      public static String getNoLoopbackIP()
      本级ip 过滤 回环地址、链路本地地址或多播地址
      Returns:
    • getAllIpAddress

      public static List<String> getAllIpAddress()
    • getAddress

      public static InetAddress getAddress()
      获取非回环网卡IP
      Returns:
    • main

      public static void main(String[] args) throws SocketException
      Throws:
      SocketException
    • getHostName

      public static String getHostName()
      获取用户机器名称
      Returns:
    • getMac

      public static String getMac(InetAddress addr)
      获取Mac地址
      Returns:
      Mac地址,例如:F0-4D-A2-39-24-A6
    • getMac

      public static String getMac()
    • getMacList

      public static List<String> getMacList()
      获取所有网卡的Mac地址
      Returns:
    • getRandomMac

      public static String getRandomMac()
      获取本机随机Mac地址
      Returns:
    • getInetAddress

      public static List<InetAddress> getInetAddress(Boolean filterLoopback) throws SocketException
      Throws:
      SocketException
    • getSystemName

      public static String getSystemName()
      获取当前系统名称
      Returns:
      当前系统名,例如: windows xp
    • convertFileSize

      public String convertFileSize(long size)
      字节转换
      Parameters:
      size - 字节大小
      Returns:
      转换后值