public final class FileUtil extends Object
Modifier and Type | Method and Description |
---|---|
static File |
createFileInTempDirectoryWithPathCheck(String filename,
String fileExtension)
Creates a new empty file in the vitam temporary directory retrieved from VitamConfiguration, using the
given filename and fileExtension strings to generate its name.
Do a Path traversal attack check before creating file |
static boolean |
deleteRecursive(File file)
CARE: delete all files and directories from this file or directory, this one included
|
static String |
getFileCanonicalPath(String pathname)
retrieve the canonical path for a given file pathname
|
static String |
readFile(File file) |
static String |
readFile(String filename) |
static String |
readInputStream(InputStream input) |
static String |
readPartialFile(File file,
int limit) |
static File |
saveInTemporaryVitamFolder(InputStream inputStream)
Save some imput stream in vitam temporary Folder
|
public static final String readFile(String filename) throws IOException
filename
- IOException
public static final String readFile(File file) throws IOException
file
- IOException
public static final String readPartialFile(File file, int limit) throws IOException
file
- limit
- the limit in bytes to readIOException
public static final boolean deleteRecursive(File file)
file
- public static final String readInputStream(InputStream input) throws IOException
input
- to readXMLStreamException
IOException
public static File saveInTemporaryVitamFolder(InputStream inputStream) throws IOException
inputStream
- the input stremIOException
- the IOExceptionpublic static File createFileInTempDirectoryWithPathCheck(String filename, String fileExtension) throws IOException
filename
- The prefix string to be used in generating the file's
name; must be at least three characters longfileExtension
- The suffix string to be used in generating the file's
name; may be null
, in which case the
suffix ".tmp"
will be usedIOException
- If a file could not be createdpublic static String getFileCanonicalPath(String pathname) throws IOException
pathname
- IOException
- If an I/O errors occursCopyright © 2019 Vitam. All rights reserved.