@Test public void testReadDirectory() throws URISyntaxException, IOException { FileSystem fs = new FileSystem(new URI("file: Path root = Paths.get("src", "test", "resources", "my-rules"); List<Path> content = fs.readDirectory(root.toUri()).collect(Collectors.toList()); assertEquals(3, content.size()); assertTrue(content.contains(root.resolve("rule1.html").toAbsolutePath())); assertTrue(content.contains(root.resolve("rule1.json").toAbsolutePath())); assertTrue(content.contains(root.resolve("rule2.json").toAbsolutePath())); }
public Stream<Path> readDirectory(URI uri) throws IOException { List<Path> paths = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.provider().getPath(uri))) { for (Path entry: stream) { paths.add(entry); } return paths.stream(); } }
FileSystem implements Closeable { public Stream<Path> readDirectory(URI uri) throws IOException { List<Path> paths = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.provider().getPath(uri))) { for (Path entry: stream) { paths.add(entry); } return paths.stream(); } } }
FileSystem implements Closeable { public Stream<Path> readDirectory(URI uri) throws IOException { List<Path> paths = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.provider().getPath(uri))) { for (Path entry: stream) { paths.add(entry); } return paths.stream(); } } FileSystem(URI uri); }
FileSystem implements Closeable { public Stream<Path> readDirectory(URI uri) throws IOException { List<Path> paths = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.provider().getPath(uri))) { for (Path entry: stream) { paths.add(entry); } return paths.stream(); } } FileSystem(URI uri); @Override void close(); Stream<Path> readDirectory(URI uri); }
FileSystem implements Closeable { public Stream<Path> readDirectory(URI uri) throws IOException { List<Path> paths = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.provider().getPath(uri))) { for (Path entry: stream) { paths.add(entry); } return paths.stream(); } } FileSystem(URI uri); @Override void close(); Stream<Path> readDirectory(URI uri);  }