com.zcj.ext.oshi.model.MemInfo Maven / Gradle / Ivy
package com.zcj.ext.oshi.model;
import com.zcj.util.UtilFile;
import com.zcj.util.UtilMath;
import java.math.BigDecimal;
public class MemInfo {
/**
* 内存总量
*/
private long total;
/**
* 已用内存
*/
private long used;
/**
* 剩余内存
*/
private long free;
// ----------------------
private String totalStr;
private String usedStr;
private String freeStr;
private BigDecimal usagePercent;
public void format() {
totalStr = UtilFile.formatSize(total);
usedStr = UtilFile.formatSize(used);
freeStr = UtilFile.formatSize(free);
usagePercent = UtilMath.percentNumber(used, total);
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public long getUsed() {
return used;
}
public void setUsed(long used) {
this.used = used;
}
public long getFree() {
return free;
}
public void setFree(long free) {
this.free = free;
}
public String getTotalStr() {
return totalStr;
}
public void setTotalStr(String totalStr) {
this.totalStr = totalStr;
}
public String getUsedStr() {
return usedStr;
}
public void setUsedStr(String usedStr) {
this.usedStr = usedStr;
}
public String getFreeStr() {
return freeStr;
}
public void setFreeStr(String freeStr) {
this.freeStr = freeStr;
}
public BigDecimal getUsagePercent() {
return usagePercent;
}
public void setUsagePercent(BigDecimal usagePercent) {
this.usagePercent = usagePercent;
}
}