textmaven.util
Class ResourceFinder

java.lang.Object
  extended bytextmaven.util.ResourceFinder

public class ResourceFinder
extends java.lang.Object

Provides methods to search for files in a specified list of directories.

Author:
krebtho

Field Summary
static java.lang.String[] DEFAULT_DIR_LIST
           
 
Constructor Summary
ResourceFinder()
           
 
Method Summary
static java.io.File findFile(java.lang.Class clasz, java.lang.String aFileName)
          Searches the specified file in various directories and returns the file name including the path where it is located.
static java.io.File findFile(java.lang.Class clasz, java.lang.String[] dirList, java.lang.String aFileName)
          Searches the specified file in the specified directories and returns the file name including the path where it is located.
static java.io.File findFile(java.lang.String aFileName)
          Searches the specified file in various directories and returns the file name including the path where it is located.
protected static java.lang.String getBasedir()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DIR_LIST

public static java.lang.String[] DEFAULT_DIR_LIST
Constructor Detail

ResourceFinder

public ResourceFinder()
Method Detail

getBasedir

protected static final java.lang.String getBasedir()

findFile

public static java.io.File findFile(java.lang.Class clasz,
                                    java.lang.String aFileName)
                             throws java.io.FileNotFoundException
Searches the specified file in various directories and returns the file name including the path where it is located. The following directories are searched in the following order: current working directory, ..\resource\, src\resource\ If not found the a getResource call is delegated to the specified class.

Parameters:
aFileName -
clasz - class to which a getResource call should be delegated if file was not found in directory list
Returns:
File
Throws:
java.io.FileNotFoundException - if the file was not found

findFile

public static java.io.File findFile(java.lang.String aFileName)
                             throws java.io.FileNotFoundException
Searches the specified file in various directories and returns the file name including the path where it is located. The following directories are searched in the following order: current working directory, ..\resource\, src\resource\ and the classpath.

Parameters:
aFileName -
Returns:
File
Throws:
java.io.FileNotFoundException - if the file was not found

findFile

public static java.io.File findFile(java.lang.Class clasz,
                                    java.lang.String[] dirList,
                                    java.lang.String aFileName)
                             throws java.io.FileNotFoundException
Searches the specified file in the specified directories and returns the file name including the path where it is located.

Parameters:
aFileName -
clasz - class to which a getResource call should be delegated if file was not found in directory list
Returns:
File
Throws:
java.io.FileNotFoundException - if the file was not found


Copyright © 2002-2005 Sourceforge. All Rights Reserved.