| 5 | import java.nio.file.*; |
| 6 | |
| 7 | public class FileSystemDemo { |
| 8 | static void show(String id, Object o) { |
| 9 | System.out.println(id + ": " + o); |
| 10 | } |
| 11 | public static void main(String[] args) { |
| 12 | System.out.println(System.getProperty("os.name")); |
| 13 | FileSystem fsys = FileSystems.getDefault(); |
| 14 | for(FileStore fs : fsys.getFileStores()) |
| 15 | show("File Store", fs); |
| 16 | for(Path rd : fsys.getRootDirectories()) |
| 17 | show("Root Directory", rd); |
| 18 | show("Separator", fsys.getSeparator()); |
| 19 | show("UserPrincipalLookupService", |
| 20 | fsys.getUserPrincipalLookupService()); |
| 21 | show("isOpen", fsys.isOpen()); |
| 22 | show("isReadOnly", fsys.isReadOnly()); |
| 23 | show("FileSystemProvider", fsys.provider()); |
| 24 | show("File Attribute Views", |
| 25 | fsys.supportedFileAttributeViews()); |
| 26 | } |
| 27 | } |
| 28 | /* Output: |
| 29 | Windows 8.1 |
| 30 | File Store: (C:) |
nothing calls this directly
no outgoing calls
no test coverage detected