public static Collection<File> listFiles( File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) { validateListFilesParameters(directory, fileFilter); IOFileFilter effFileFilter = setUpEffectiveFileFilter(fileFilter); IOFileFilter effDirFilter = setUpEffectiveDirFilter(dirFilter); Collection<File> files = new LinkedList(); innerListFiles( files, directory, FileFilterUtils.or(new IOFileFilter[] {effFileFilter, effDirFilter}), false); return files; }
private static IOFileFilter setUpEffectiveDirFilter(IOFileFilter dirFilter) { return dirFilter == null ? FalseFileFilter.INSTANCE : FileFilterUtils.and(new IOFileFilter[] {dirFilter, DirectoryFileFilter.INSTANCE}); }
private static IOFileFilter setUpEffectiveFileFilter(IOFileFilter fileFilter) { return FileFilterUtils.and( new IOFileFilter[] { fileFilter, FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE) }); }