Package com.axelor.file.temp
Class TempFiles
java.lang.Object
com.axelor.file.temp.TempFiles
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clean()
Clean up obsolete temporary files from upload directory.static void
This method can be used to delete temporary file of an incomplete upload.static Path
Create a temporary directorystatic Path
createTempDir
(String prefix) Create a temporary directorystatic Path
Create a temporary file.static Path
createTempFile
(String prefix, String suffix, FileAttribute<?>... attrs) Create a temporary file.static Path
findTempFile
(String name) Find a temporary file by the given name created previously.static Path
Get the root path to deal with temp file/dirstatic Path
Get the path to deal with temp upload file/dir
-
Constructor Details
-
TempFiles
public TempFiles()
-
-
Method Details
-
getTempPath
Get the path to deal with temp upload file/dir- Returns:
- the temp path
-
getRootTempPath
Get the root path to deal with temp file/dir- Returns:
- the root temp path
-
createTempFile
Create a temporary file.- Returns:
- the path to the newly created file
- Throws:
IOException
- if an I/O error occurs
-
createTempFile
public static Path createTempFile(String prefix, String suffix, FileAttribute<?>... attrs) throws IOException Create a temporary file.- Parameters:
prefix
- the file prefix to usesuffix
- the file suffix to useattrs
- an optional list of file attributes- Returns:
- the path to the newly created file
- Throws:
IOException
- if an I/O error occurs- See Also:
-
findTempFile
Find a temporary file by the given name created previously.- Parameters:
name
- name of the temp file- Returns:
- file path
-
createTempDir
Create a temporary directory- Returns:
- the path to the newly created directory
- Throws:
IOException
- if an I/O error occurs
-
createTempDir
Create a temporary directory- Parameters:
prefix
- the prefix string to be used in generating the directory's name- Returns:
- the path to the newly created directory
- Throws:
IOException
- if an I/O error occurs
-
clean
This method can be used to delete temporary file of an incomplete upload.- Parameters:
fileId
- the upload file id- Throws:
IOException
- if an I/O error occurs
-
clean
Clean up obsolete temporary files from upload directory.- Throws:
IOException
- if an I/O error occurs
-