Java Path File Check nio isEmptyDir(Path path)

Here you can find the source of isEmptyDir(Path path)

Description

is Empty Dir

License

Apache License

Declaration

public static boolean isEmptyDir(Path path) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.file.*;

public class Main {
    public static boolean isEmptyDir(Path path) {
        try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(path)) {
            return !dirStream.iterator().hasNext();
        } catch (Exception e) {
            //            logger.warn("Problem occured while checking is directory empty {}", path);
        }//w  ww  .  j  a  va 2  s.  c o m
        return false;
    }
}

Related

  1. isDirectoryInPath(File p, File d)
  2. isDirEmpty(final Path directory)
  3. isEmpty(Path dir)
  4. isEmptyDir(Path dir)
  5. isEmptyDir(Path path)
  6. isEqualPath(final Path file1, final String topLevelAbsolutePath)
  7. isExcluded(Set excludes, Path path)
  8. isFile(final String path)
  9. isFile(Path file)