--- old/src/share/sample/nio/file/DiskUsage.java Wed Jan 26 14:12:34 2011 +++ new/src/share/sample/nio/file/DiskUsage.java Wed Jan 26 14:12:33 2011 @@ -43,12 +43,10 @@ static final long K = 1024; static void printFileStore(FileStore store) throws IOException { - FileStoreSpaceAttributes attrs = Attributes.readFileStoreSpaceAttributes(store); + long total = store.getTotalSpace() / K; + long used = (store.getTotalSpace() - store.getUnallocatedSpace()) / K; + long avail = store.getUsableSpace() / K; - long total = attrs.totalSpace() / K; - long used = (attrs.totalSpace() - attrs.unallocatedSpace()) / K; - long avail = attrs.usableSpace() / K; - String s = store.toString(); if (s.length() > 20) { System.out.println(s); @@ -66,7 +64,7 @@ } } else { for (String file: args) { - FileStore store = Paths.get(file).getFileStore(); + FileStore store = Files.getFileStore(Paths.get(file)); printFileStore(store); } }