Package io.vertigo.core.util
Class FileUtil
java.lang.Object
io.vertigo.core.util.FileUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckUserFileName(String userFileName) Check a filename send by a user.static voidcheckUserPath(String userPath) Check a filePath send by a user.static voidcopy(InputStream in, File file) Copie le contenu d'un flux d'entrée vers un fichier de sortie.static <R> Rstatic StringgetFileExtension(String fileName) Donne l'extension du fichier.static longgetFileSize(URL url) static Stringstatic StringsanitizeFileName(String fileName) static StringtranslatePath(String path) Replace "user.home" "user.dir" and "java.io.tmpdir" by system value.
-
Method Details
-
doOnFile
-
read
-
getFileSize
-
copy
Copie le contenu d'un flux d'entrée vers un fichier de sortie.- Parameters:
in- flux d'entréefile- fichier de sortie- Throws:
IOException- Erreur d'entrée/sortie
-
getFileExtension
Donne l'extension du fichier.This method returns the textual part of the filename after the last dot. There must be no directory separator after the dot.
foo.txt --> "txt" a/b/c.jpg --> "jpg" a/b.txt/c --> "" a/b/c --> ""
The output will be the same irrespective of the machine that the code is running on.
- Parameters:
fileName- Nom du fichier- Returns:
- the extension of the file or an empty string if none exists. (author Apache Commons IO 1.1)
-
translatePath
Replace "user.home" "user.dir" and "java.io.tmpdir" by system value.- Parameters:
path- PAth to translate- Returns:
- translated path
-
checkUserPath
Check a filePath send by a user.- Parameters:
userPath- Path to check
-
checkUserFileName
Check a filename send by a user.- Parameters:
userFileName- FileName to check
-
sanitizeFileName
-