|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.zmicer.utils.FileUtils
public class FileUtils
This utility class is used for all the file related operations.
$Author:: zmicer $
Field Summary | |
---|---|
static org.apache.log4j.Logger |
LOG
Logger instance. |
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static String |
constructPath(String... args)
Construct the full path using the provide variable args. |
static List<File> |
findFilesByRE(File dirFile,
Pattern reFileDefinition)
Find files by regular expression provided. |
static List<File> |
findFilesByRE(String dirName,
Pattern reFileDefinition)
Accumulate all the files by the provided Regular Expression Patterns. |
static List<File> |
findFilesByREInClassPath(List<String> classPathStrings,
Pattern reFileDefinition)
Find the files using the provided regular expression (e.g |
static List<File> |
findFoldersByRE(File dirFile,
Pattern reFolderDefinition)
Find files by regular expression provided. |
static List<File> |
findFoldersByRE(String dirName,
Pattern reFolderDefinition)
Accumulate all the files by the provided Regular Expression Patterns. |
static String |
getFolderBaseName(String folderFullName)
Get the folder name inself using the provided full or relative folder name |
static ResourceBundle |
getResourceBundleViaFile(String resourceName)
Get the resource bundle using the File class facilities (inside the method the PropertyResourceBundle is used). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger LOG
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static List<File> findFilesByRE(String dirName, Pattern reFileDefinition)
dirName
- the dir name.reFileDefinition
- Pattern for the regular expression to find all the files
public static List<File> findFilesByRE(File dirFile, Pattern reFileDefinition)
dirFile
- dir file where we would find the file defined by Regular Expression
Can not be null (otherwise IllegalArgumentException
would appear). It should be the valid
directory, otherwise IllegalArgumentException
would appearreFileDefinition
- regular expression for the file name
Can not be null (otherwise IllegalArgumentException
would appear).
public static List<File> findFoldersByRE(String dirName, Pattern reFolderDefinition)
dirName
- the dir name.reFolderDefinition
- Pattern for the regular expression to find all the files
public static List<File> findFoldersByRE(File dirFile, Pattern reFolderDefinition)
dirFile
- dir file where we would find the file defined by Regular Expression
Can not be null (otherwise IllegalArgumentException
would appear). It should be the valid
directory, otherwise IllegalArgumentException
would appearreFolderDefinition
- pattern object for the name of the folder we are looking for
Can not be null (otherwise IllegalArgumentException
would appear).
public static List<File> findFilesByREInClassPath(List<String> classPathStrings, Pattern reFileDefinition)
ClassPathUtils.getClassPathes()
for details).
classPathStrings
- the List of String objects, Can not be null (otherwise IllegalArgumentException
would appear).reFileDefinition
- the Pattern compliled before,
Can not be null (otherwise IllegalArgumentException
would appear).
File
object (file.isFile
would be return true
)public static String getFolderBaseName(String folderFullName)
folderFullName
- the folder name we should analyze, Can not be null (otherwise IllegalArgumentException
would
appear).
public static ResourceBundle getResourceBundleViaFile(String resourceName)
File
class facilities (inside the method the PropertyResourceBundle
is used).
resourceName
- the name of the resource, Can not be null (otherwise IllegalArgumentException
would appear).
Be noticed it could take the following types of values: 1. the full or relative path to the resource using the
File.separator 2. the relative path to the resource where the dot (".") is used as the separator.
null
in the case there is no appropriate resource bundle or it has
wrong format, or smth else went in the wrong way.public static String constructPath(String... args)
args
- the variable args, Can not be null (otherwise IllegalArgumentException
would appear). The members of this
cannot be null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |