Пример #1
0
 private ArrayList<Path> holeLaufwerkeUnix() {
   ArrayList<Path> laufwerksRoot = new ArrayList<>();
   for (FileStore store : FileSystems.getDefault().getFileStores()) {
     if (store.name().contains("/dev/sd")) {
       laufwerksRoot.add(
           Paths.get(store.toString().substring(0, store.toString().indexOf(' '))));
     }
   }
   return laufwerksRoot;
 }
Пример #2
0
  static void printFileStore(FileStore store) throws IOException {
    String total = format(store.getTotalSpace());
    String used = format(store.getTotalSpace() - store.getUnallocatedSpace());
    String avail = format(store.getUsableSpace());

    String s = store.toString();
    if (s.length() > 20) {
      System.out.println(s);
      s = "";
    }
    System.out.format("%-20s %12s %12s %12s\n", s, total, used, avail);
  }