提供些获取系统信息相关的工具方法
| 18 | * 提供些获取系统信息相关的工具方法 |
| 19 | */ |
| 20 | public class SysHepler { |
| 21 | |
| 22 | /** |
| 23 | * JVM的版本 |
| 24 | */ |
| 25 | public static final String JVM_VERSION = PropertiesUtil.key(Opslab.JVM_VERSION); |
| 26 | /** |
| 27 | * JVM的编码 |
| 28 | */ |
| 29 | public static final String JVM_ENCODING = PropertiesUtil.key(Opslab.JVM_ENCODING); |
| 30 | /** |
| 31 | * JVM默认的临时目录 |
| 32 | */ |
| 33 | public static final String JVM_TEMPDIR = PropertiesUtil.key(Opslab.JVM_TEMPDIR); |
| 34 | |
| 35 | /** |
| 36 | * 主机IP |
| 37 | */ |
| 38 | public static String HOST_IP; |
| 39 | /** |
| 40 | * 主机名 |
| 41 | */ |
| 42 | public static String HOST_NAME; |
| 43 | |
| 44 | /** |
| 45 | * 主机架构 |
| 46 | */ |
| 47 | public static String OS_ARCH = PropertiesUtil.key(Opslab.SYS_OS_ARCH); |
| 48 | /** |
| 49 | * 主机类型 |
| 50 | */ |
| 51 | public static String OS_NAME = PropertiesUtil.key(Opslab.SYS_OS_NAME); |
| 52 | /** |
| 53 | * 主机类型版本 |
| 54 | */ |
| 55 | public static String OS_VERSION = PropertiesUtil.key(Opslab.SYS_OS_VERSION); |
| 56 | /** |
| 57 | * 操作系统类型 |
| 58 | */ |
| 59 | public static String SUN_DESKTOP = PropertiesUtil.key(Opslab.SYS_SUN_DESKTOP); |
| 60 | |
| 61 | |
| 62 | public static String FILE_SEPARATOR = PropertiesUtil.key(Opslab.SYS_FILE_SEPARATOR); |
| 63 | public static String PATH_SEPARATOR = PropertiesUtil.key(Opslab.SYS_PATH_SEPARATOR); |
| 64 | public static String LINE_SEPARATOR = PropertiesUtil.key(Opslab.SYS_LINE_SEPARATOR); |
| 65 | /** |
| 66 | * 总的物理内存 |
| 67 | */ |
| 68 | public static long TotalMemorySize; |
| 69 | private static OperatingSystemMXBean osmxb; |
| 70 | private static int kb = 1024; |
| 71 | |
| 72 | static { |
| 73 | |
| 74 | try { |
| 75 | |
| 76 | InetAddress addr = InetAddress.getLocalHost(); |
| 77 | HOST_NAME = addr.getHostName(); |
nothing calls this directly
no test coverage detected