org.clapper.util.io
Class RecursiveFileFinder

java.lang.Object
  extended by org.clapper.util.io.RecursiveFileFinder

public class RecursiveFileFinder
extends java.lang.Object

A RecursiveFileFinder walks a directory tree and finds all files (or directories) that satisfy caller-supplied criteria. The match criteria are specified via either a FileFilter or FilenameFilter object.

Version:
$Revision: 6735 $
Author:
Copyright © 2004-2007 Brian M. Clapper

Constructor Summary
RecursiveFileFinder()
          Construct a new RecursiveFileFinder object.
 
Method Summary
 int findFiles(java.io.File directory, java.util.Collection<java.io.File> collection)
          Find all files beneath a given directory.
 int findFiles(java.io.File directory, java.io.FileFilter filter, java.util.Collection<java.io.File> collection)
          Find all files beneath a given directory, filtered by the specified FilenameFilter.
 int findFiles(java.io.File directory, java.io.FilenameFilter filter, java.util.Collection<java.io.File> collection)
          Find all files beneath a given directory, filtered by the specified FilenameFilter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecursiveFileFinder

public RecursiveFileFinder()
Construct a new RecursiveFileFinder object. The various find() methods actually provide the searching capabilities.

Method Detail

findFiles

public int findFiles(java.io.File directory,
                     java.util.Collection<java.io.File> collection)
Find all files beneath a given directory. This version of find() takes no filter, so every file and directory is matched.

Parameters:
directory - the starting directory
collection - where to store the found File objects
Returns:
the number of File objects found

findFiles

public int findFiles(java.io.File directory,
                     java.io.FilenameFilter filter,
                     java.util.Collection<java.io.File> collection)
Find all files beneath a given directory, filtered by the specified FilenameFilter.

Parameters:
directory - the starting directory
filter - the FilenameFilter to use to filter the file names, or null to accept all files
collection - where to store the found File objects
Returns:
the number of File objects found

findFiles

public int findFiles(java.io.File directory,
                     java.io.FileFilter filter,
                     java.util.Collection<java.io.File> collection)
Find all files beneath a given directory, filtered by the specified FilenameFilter.

Parameters:
directory - the starting directory
filter - the FilenameFilter to use to filter the file names, or null to accept all files
collection - where to store the found File objects
Returns:
the number of File objects found


Copyright © 2004-2007 Brian M. Clapper. All Rights Reserved.