Package fr.paris.lutece.util.file
Class FileUtil
java.lang.Object
fr.paris.lutece.util.file.FileUtil
Utility class for files
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeleteFile(File file) Delete the file.static booleanhasFreemarkerExtension(String strFileName) Check if a file has a valid Freemarker extensionstatic booleanhasHtmlExtension(String strFileName) Check if a file has a valid html extensionstatic booleanhasImageExtension(String strImageFileName) Check if the extension of the file is an image extensionstatic final StringnormalizeFileName(String string) Converts French diacritics characters into non diacritics.static voidcreates a zip file
-
Field Details
-
CONSTANT_MIME_TYPE_ZIP
- See Also:
-
CONSTANT_MIME_TYPE_CSV
- See Also:
-
EXTENSION_ZIP
- See Also:
-
EXTENSION_CSV
- See Also:
-
-
Method Details
-
hasImageExtension
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
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
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
creates a zip file- Parameters:
zipFile- the zipfile to createfiles- to add to the Zip- Throws:
IOException
-
normalizeFileName
Converts French diacritics characters into non diacritics.
Replace whitespaces by underscores
Keep only underscores and alphanum characters
Transform to lowercase- Parameters:
string-- Returns:
-
deleteFile
Delete the file.
Logs an error if the delete is not succesful.- Parameters:
pathname-
-