List of utility methods to do Path File Check nio
boolean | isDirectoryEmpty(Path path) is Directory Empty if (!Files.isDirectory(path)) { return false; try (DirectoryStream<Path> ds = Files.newDirectoryStream(path)) { return !ds.iterator().hasNext(); } catch (IOException ex) { return false; |
boolean | isDirectoryEmpty(String dirPath) is Directory Empty Path path = Paths.get(dirPath); try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) { return !stream.iterator().hasNext(); |
boolean | isDirectoryInPath(File p, File d) is Directory In Path try { Path p_ = getAbsolutePath(p); Path d_ = getAbsolutePath(d); return d_.toString().startsWith(p_.toString()); } catch (NullPointerException | IOException e) { return false; |
boolean | isDirEmpty(final Path directory) is Dir Empty try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(directory)) { return !dirStream.iterator().hasNext(); |
boolean | isEmpty(Path dir) is Empty try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) { return !stream.iterator().hasNext(); |
boolean | isEmptyDir(Path dir) is Empty Dir try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) { return !stream.iterator().hasNext(); |
boolean | isEmptyDir(Path path) is Empty Dir try (DirectoryStream<Path> ds = Files.newDirectoryStream(path)) { Iterator<Path> files = ds.iterator(); return !files.hasNext(); |
boolean | isEmptyDir(Path path) is Empty Dir try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(path)) { return !dirStream.iterator().hasNext(); } catch (Exception e) { return false; |
boolean | isEqualPath(final Path file1, final String topLevelAbsolutePath) is Equal Path return topLevelAbsolutePath.equals(file1.toAbsolutePath().toString());
|
boolean | isExcluded(Set Checks if specified path is within excludes for (PathMatcher matcher : excludes) { if (matcher.matches(path)) { return true; return false; |