java怎么獲取硬件信息
java怎么獲取硬件信息
你們知道電腦的硬件信息怎么獲取嗎,下面是學(xué)習(xí)啦小編帶來java怎么獲取硬件信息的內(nèi)容,歡迎閱讀!
java怎么獲取硬件信息?
IMonitorService接口:
public interface IMonitorService {
public MonitorInfoBean getMonitorInfoBean() throws Exception;
}
MonitorInfoBean類:
/*采集系統(tǒng)存取數(shù)據(jù)JavaBean*/
public class MonitorInfoBean implements Comparable<MonitorInfoBean> {
/** 操作系統(tǒng). */
private String osName;
/** 總的物理內(nèi)存. */
private float totalMemorySize;
/** 已使用的物理內(nèi)存. */
private float usedMemory;
/** cpu使用率. */
private double cpuRatio;
/** 主機(jī)IP地址 */
private String mIpAddress;
/** 數(shù)據(jù)存儲(chǔ)時(shí)間 */
private String dDateTime;
/**內(nèi)存使用率*/
private float memoryRatio;
/**linux下Buffers內(nèi)存*/
private float buffersMemory;
/**linux下Cached內(nèi)存*/
private float cachedMemory;
public float getBuffersMemory() {
return buffersMemory;
}
public float getCachedMemory() {
return cachedMemory;
}
public String getDDateTime() {
return dDateTime;
}
public void setDDateTime(String dateTime) {
dDateTime = dateTime;
}
public String getMIpAddress() {
return mIpAddress;
}
public void setMIpAddress(String ipAddress) {
mIpAddress = ipAddress;
}
public String getOsName() {
return osName;
}