foundry-0.9.1

foundry.io
Class FileFinder

java.lang.Object
  |
  +--foundry.io.FileFinder
All Implemented Interfaces:
Runnable

public class FileFinder
extends Object
implements Runnable

A class that finds files in a filesystem.

Version:
@@VERSION@@
Author:
Laird Nelson
See Also:
File

Field Summary
private  Set files
          The Set of files that were found.
private  File startingPoint
          The directory from which to conduct the search.
 
Constructor Summary
FileFinder()
          Creates a new FileFinder whose search will begin from the current directory.
FileFinder(File startingPoint)
          Creates a new FileFinder whose search will begin from the supplied directory.
FileFinder(File startingPoint, Set files)
          Creates a new FileFinder whose search will begin from the supplied directory, and whose results will be placed in the supplied Set.
FileFinder(String startingPoint)
          Creates a new FileFinder whose search will begin from the directory identified by the supplied path.
FileFinder(String startingPoint, Set files)
          Creates a new FileFinder whose search will begin from the directory identified by the supplied path, and whose results will be placed in the supplied Set.
 
Method Summary
 Set getFiles()
          Returns the results of a previously started search.
private  void init(File startingPoint, Set files)
          Initializes this FileFinder.
static void main(String[] args)
          Creates a new FileFinder and starts a search, ultimately printing out each file's full path.
 void run()
          Causes this FileFinder to begin its search.
 void start()
          Causes this FileFinder to begin its search.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

startingPoint

private File startingPoint
The directory from which to conduct the search.

files

private Set files
The Set of files that were found.
Constructor Detail

FileFinder

public FileFinder()
Creates a new FileFinder whose search will begin from the current directory.

FileFinder

public FileFinder(File startingPoint)
Creates a new FileFinder whose search will begin from the supplied directory.
Parameters:
startingPoint - the directory from which the search will begin

FileFinder

public FileFinder(String startingPoint)
Creates a new FileFinder whose search will begin from the directory identified by the supplied path.
Parameters:
startingPoint - the path of the directory from which the search will begin

FileFinder

public FileFinder(File startingPoint,
                  Set files)
Creates a new FileFinder whose search will begin from the supplied directory, and whose results will be placed in the supplied Set.
Parameters:
startingPoint - the directory from which the search will begin
files - the Set into which the results of the search will be placed; each element will be a File

FileFinder

public FileFinder(String startingPoint,
                  Set files)
Creates a new FileFinder whose search will begin from the directory identified by the supplied path, and whose results will be placed in the supplied Set.
Parameters:
startingPoint - the path of the directory from which the search will begin
files - the Set into which the results of the search will be placed; each element will be a File
Method Detail

init

private void init(File startingPoint,
                  Set files)
Initializes this FileFinder.
Parameters:
startingPoint - the directory from which the search will begin; if null, the current directory will be used instead
files - the Set into which the results of the search will be placed; each element will be a File

start

public void start()
Causes this FileFinder to begin its search.

run

public void run()
Causes this FileFinder to begin its search.
Specified by:
run in interface Runnable

getFiles

public Set getFiles()
Returns the results of a previously started search.
Returns:
the results of a previously started search as a Set

main

public static void main(String[] args)
                 throws Exception
Creates a new FileFinder and starts a search, ultimately printing out each file's full path. The first element in the supplied args parameter is taken to be the path to a directory from which to begin the search. If args is null, or has no elements, then the search will occur from the current directory.
Parameters:
args - the command line arguments; the first element is taken to be the path to a directory from which to begin the search
Throws:
Exception - if an unexpected error occurs

foundry-0.9.1

Copyright © 2000 - Laird Jarrett Nelson