Class FileUtils


  • public class FileUtils
    extends Object
    Lightweight File utilities
    Author:
    markr
    • Constructor Detail

      • FileUtils

        public FileUtils()
    • 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 dir
        fileExtension - the file extension, e.g. ".xml"
        Returns:
        the list of files that match this extension in the dir
        Throws:
        PlanItException - thrown if error