List of usage examples for java.nio.file FileStore getUnallocatedSpace
public abstract long getUnallocatedSpace() throws IOException;
From source file:Main.java
public static void main(String[] args) throws IOException { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore store : fileSystem.getFileStores()) { long total = store.getUnallocatedSpace() / 1024; System.out.println(total); }// w w w .j ava 2 s . com }
From source file:Test.java
public static void main(String[] args) throws Exception { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore fileStore : fileSystem.getFileStores()) { long totalSpace = fileStore.getTotalSpace() / kiloByte; long usedSpace = (fileStore.getTotalSpace() - fileStore.getUnallocatedSpace()) / kiloByte; long usableSpace = fileStore.getUsableSpace() / kiloByte; String name = fileStore.name(); String type = fileStore.type(); boolean readOnly = fileStore.isReadOnly(); }/*from w w w . j av a 2s .c o m*/ }
From source file:Main.java
public static void printDetails(FileStore store) { try {//from w w w . j av a2 s . c o m String desc = store.toString(); String type = store.type(); long totalSpace = store.getTotalSpace(); long unallocatedSpace = store.getUnallocatedSpace(); long availableSpace = store.getUsableSpace(); System.out.println(desc + ", Total: " + totalSpace + ", Unallocated: " + unallocatedSpace + ", Available: " + availableSpace); } catch (IOException e) { e.printStackTrace(); } }