Package org.planit.utils.misc
Class FileUtils
- java.lang.Object
-
- org.planit.utils.misc.FileUtils
-
public class FileUtils extends Object
Lightweight File utilities- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description FileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetExtension(File file)Collect the extension of a file.static File[]getFilesWithExtensionFromDir(String pathToDir, String fileExtension)collect all files from a directory with the given extension
-
-
-
Field Detail
-
DOT
public static final String DOT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getExtension
public static String getExtension(File file)
Collect the extension of a file. In case the file is hidden (starts with "." it does not count as extension)- Parameters:
file- the file to get it from- Returns:
- the extension, if it does not exist return empty string
-
getFilesWithExtensionFromDir
public static File[] getFilesWithExtensionFromDir(String pathToDir, String fileExtension) throws PlanItException
collect all files from a directory with the given extension- Parameters:
pathToDir- path to dirfileExtension- the file extension, e.g. ".xml"- Returns:
- the list of files that match this extension in the dir
- Throws:
PlanItException- thrown if error
-
-