java怎么獲取硬件信息(2)
java怎么獲取硬件信息
public void setOsName(String osName) {
this.osName = osName;
}
public float getTotalMemorySize() {
return totalMemorySize;
}
public void setTotalMemorySize(float totalMemorySize) {
this.totalMemorySize = totalMemorySize;
}
public float getUsedMemory() {
return usedMemory;
}
public void setUsedMemory(long usedMemory) {
this.usedMemory = usedMemory;
}
public double getCpuRatio() {
return cpuRatio;
}
public void setCpuRatio(double cpuRatio) {
this.cpuRatio = cpuRatio;
}
public int compareTo(MonitorInfoBean m) {
String stra = this.getDDateTime();
String strb = m.getDDateTime();
Timestamp a = Timestamp.valueOf(stra);
Timestamp b = Timestamp.valueOf(strb);
if (a.before(b)) {
return -1;
} else if (a.after(b)) {
return 1;
} else {
return 0;
}
}
public float getMemoryRatio() {
return memoryRatio;
}
public void setMemoryRatio(float memoryRatio) {
this.memoryRatio = memoryRatio;
}
public void setUsedMemory(float usedMemory) {
this.usedMemory = usedMemory;
}
public void setBuffersMemory(float buffersMemory) {
this.buffersMemory = buffersMemory;
}
public void setCachedMemory(float cachedMemory) {
this.cachedMemory = cachedMemory;
}
}
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.StringTokenizer;
import sun.management.ManagementFactory;
import com.sun.management.OperatingSystemMXBean;
/*采集系統(tǒng)采集數(shù)據(jù)實現(xiàn)類*/
/**
* @author Administrator
*
*/
看了“java怎么獲取硬件信息”的內(nèi)容的人還看: