publicclass Main { publicstaticvoid main(String[] args) throws Exception {
FileSystem fs = FileSystems.getDefault(); if (fs.getClass().getModule() == Object.class.getModule()) thrownew RuntimeException("FileSystemProvider not overridden");
// exercise the file system
Path dir = Files.createTempDirectory("tmp"); if (dir.getFileSystem() != fs) thrownew RuntimeException("'dir' not in default file system");
System.out.println("created: " + dir);
Path foo = Files.createFile(dir.resolve("foo")); if (foo.getFileSystem() != fs) thrownew RuntimeException("'foo' not in default file system");
System.out.println("created: " + foo);
// exercise interop with java.io.File
File file = foo.toFile();
Path path = file.toPath(); if (path.getFileSystem() != fs) thrownew RuntimeException("'path' not in default file system"); if (!path.equals(foo)) thrownew RuntimeException(path + " not equal to " + foo);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.