classUtils.pathUtils
Class FileUtil

java.lang.Object
  extended by classUtils.pathUtils.FileUtil

public class FileUtil
extends java.lang.Object

Utility class for various File related actions and methods

Since:
2.1.0
Version:
0.0.1
Author:
E. Michael Maximilien

Method Summary
static java.io.File findFile(java.lang.String fileName, boolean searchInClassPath)
           
static java.io.InputStream loadFile(java.lang.String fileName, boolean searchInClassPath, boolean searchInJarFile)
           
static boolean locateFile(java.lang.String fileName, boolean searchInClassPath, boolean searchInJarFile)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

locateFile

public static boolean locateFile(java.lang.String fileName,
                                 boolean searchInClassPath,
                                 boolean searchInJarFile)
Parameters:
fileName - the relative fileName to search for
searchInClassPath - if true the file will be searched in all directories specified by CLASSPATH
searchInJarFile - if true the file will be searched in all the JAR files that are located in CLASSPATH
Returns:
true if the File passed by name below could be located by searching the classpath and or JAR files in CLASSPATH

findFile

public static java.io.File findFile(java.lang.String fileName,
                                    boolean searchInClassPath)
Parameters:
fileName - the relative fileName to search for
searchInClassPath - if true the file will be searched in all directories specified by CLASSPATH
Returns:
the File object if found otherwise returns null

loadFile

public static java.io.InputStream loadFile(java.lang.String fileName,
                                           boolean searchInClassPath,
                                           boolean searchInJarFile)
                                    throws java.io.FileNotFoundException,
                                           java.io.IOException
Parameters:
fileName - the relative fileName to search for
searchInClassPath - if true the file will be searched in all directories specified by CLASSPATH
searchInJarFile - if true the file will be searched in all the JAR files that are located in CLASSPATH
Returns:
a FileIOStream object for the file passed by name below could be located by searching the classpath and or JAR files in CLASSPATH
Throws:
java.io.FileNotFoundException - if the file could not be found
java.io.IOException - if an error occurred while loading file