Package io.vertigo.core.util
Class FileUtil
- java.lang.Object
-
- io.vertigo.core.util.FileUtil
-
public final class FileUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkUserFileName(String userFileName)
Check a filename send by a user.static void
checkUserPath(String userPath)
Check a filePath send by a user.static void
copy(InputStream in, File file)
Copie le contenu d'un flux d'entrée vers un fichier de sortie.static void
copy(InputStream in, OutputStream out)
Copie le contenu d'un flux d'entrée vers un flux de sortie.static String
getFileExtension(String fileName)
Donne l'extension du fichier.static String
read(URL url)
static String
translatePath(String path)
Replace "user.home" "user.dir" and "java.io.tmpdir" by system value.
-
-
-
Method Detail
-
copy
public static void copy(InputStream in, OutputStream out) throws IOException
Copie le contenu d'un flux d'entrée vers un flux de sortie.- Parameters:
in
- flux d'entréeout
- flux de sortie- Throws:
IOException
- Erreur d'entrée/sortie
-
copy
public static void copy(InputStream in, File file) throws IOException
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
public static String getFileExtension(String fileName)
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
public static String translatePath(String path)
Replace "user.home" "user.dir" and "java.io.tmpdir" by system value.- Parameters:
path
- PAth to translate- Returns:
- translated path
-
checkUserPath
public static void checkUserPath(String userPath)
Check a filePath send by a user.- Parameters:
userPath
- Path to check
-
checkUserFileName
public static void checkUserFileName(String userFileName)
Check a filename send by a user.- Parameters:
userFileName
- FileName to check
-
-