public DirectoryDescendingFileFinderImpl(File root, FilenameFilter filter, boolean canonical) throws IOException { if (!root.isDirectory()) throw new IllegalArgumentException(root.getName() + " is not a directory."); this.filter = filter; this.canonical = canonical; blossomDirectory(root); while (files.empty() && !direx.empty()) blossomDirectory((File) direx.pop()); }
public File nextFile() throws IOException { if (files.empty()) throw new NoSuchElementException(); File out = (File) files.pop(); while (files.empty() && !direx.empty()) blossomDirectory((File) direx.pop()); return out; }
public boolean hasMoreFiles() { return !files.empty(); }