public class FileUtil {
private static Logger LOG = LoggerFactory.getLogger(FileUtil.class);
private static String format(long num, String patten) {
DecimalFormat df = new DecimalFormat(patten);
return df.format(num);
}
public static String spaceInfo(String pos) {
File file = new File(pos + ":");
long totalSpace = file.getTotalSpace(); // total disk space in bytes.
long freeSpace = file.getFreeSpace(); // unallocated / free disk space in bytes.
long usedSpace = totalSpace - freeSpace;
return pos.toUpperCase() + "盘总容量:" + format(totalSpace / 1048576, "0,000") +