Class FileUtil


  • public final class FileUtil
    extends java.lang.Object
    Utility class for files
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void deleteFile​(java.io.File file)
      Delete the file.
      static boolean hasFreemarkerExtension​(java.lang.String strFileName)
      Check if a file has a valid Freemarker extension
      static boolean hasHtmlExtension​(java.lang.String strFileName)
      Check if a file has a valid html extension
      static boolean hasImageExtension​(java.lang.String strImageFileName)
      Check if the extension of the file is an image extension
      static java.lang.String normalizeFileName​(java.lang.String string)
      Converts French diacritics characters into non diacritics.
      static void zipFiles​(java.nio.file.Path zipFile, java.nio.file.Path... paths)
      creates a zip file
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • hasImageExtension

        public static boolean hasImageExtension​(java.lang.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​(java.lang.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​(java.lang.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​(java.nio.file.Path zipFile,
                                    java.nio.file.Path... paths)
                             throws java.io.IOException
        creates a zip file
        Parameters:
        zipFile - the zipfile to create
        files - to add to the Zip
        Throws:
        java.io.IOException
      • normalizeFileName

        public static final java.lang.String normalizeFileName​(java.lang.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​(java.io.File file)
        Delete the file.
        Logs an error if the delete is not succesful.
        Parameters:
        pathname -