code: private void checkEmpty(Directory dir, Path pathForException) throws FileSystemException {
      if (!dir.isEmpty()) {
        throw new DirectoryNotEmptyException(pathForException.toString());
      }
    }
docs: Checks that given directory is empty, throwing {@link DirectoryNotEmptyException} if not.