de.rico.engine.util
Class FileFinder

java.lang.Object
  extended by de.rico.engine.util.FileFinder

public class FileFinder
extends java.lang.Object

This class can be used to instanciate an object for findng files of certain file extensions in a specified directory and all its subdirectories

Author:
Frank Bruns, but the basics of the code originate from the book "Java ist auch eine Insel" by Christian Ullenboom

Method Summary
 java.lang.String[] getAbsoluteFilePathes(java.lang.String startDirectory, java.lang.String ext)
          Returns the absolute file pathes of every found file.
 java.util.List<java.io.File> getFiles(java.lang.String startDirectory, java.lang.String ext)
          Returns a list of found files (no absolute file pathes).
static FileFinder getInstance()
          Returns the singleton instance of the file finder.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static FileFinder getInstance()
Returns the singleton instance of the file finder.

Returns:
file finder instance

getFiles

public java.util.List<java.io.File> getFiles(java.lang.String startDirectory,
                                             java.lang.String ext)
Returns a list of found files (no absolute file pathes).

Parameters:
startDirectory - diretory to start in looking for files
ext - file extension to look for, e.g. ".txt" or ".bsh"
Returns:
list of found files

getAbsoluteFilePathes

public java.lang.String[] getAbsoluteFilePathes(java.lang.String startDirectory,
                                                java.lang.String ext)
Returns the absolute file pathes of every found file.

Parameters:
startDirectory - diretory to start in looking for files
ext - file extension to look for, e.g. ".txt" or ".bsh"
Returns:
String array of absolute file pathes