Class FileUtil


  • public final class FileUtil
    extends Object
    Utility class for files
    • Method Detail

      • hasImageExtension

        public static boolean hasImageExtension​(String strImageFileName)
        Check if the extension of the file is an image extension
        Parameters:
        strImageFileName - The file name to check
        Returns:
        True if the extension is correct, false otherwise
      • hasHtmlExtension

        public static boolean hasHtmlExtension​(String strFileName)
        Check if a file has a valid html extension
        Parameters:
        strFileName - The file name to check
        Returns:
        True if the file name is valid, false otherwise
      • hasFreemarkerExtension

        public static boolean hasFreemarkerExtension​(String strFileName)
        Check if a file has a valid Freemarker extension
        Parameters:
        strFileName - The file name to check
        Returns:
        True if the file name is valid, false otherwise
      • zipFiles

        public static void zipFiles​(Path zipFile,
                                    Path... paths)
                             throws IOException
        creates a zip file
        Parameters:
        zipFile - the zipfile to create
        files - to add to the Zip
        Throws:
        IOException
      • normalizeFileName

        public static final String normalizeFileName​(String string)
        Converts French diacritics characters into non diacritics.
        Replace whitespaces by underscores
        Keep only underscores and alphanum characters
        Transform to lowercase
        Parameters:
        string -
        Returns:
      • deleteFile

        public static void deleteFile​(File file)
        Delete the file.
        Logs an error if the delete is not succesful.
        Parameters:
        pathname -