public class TempFileServiceImpl extends java.lang.Object implements TempFileService
Constructor and Description |
---|
TempFileServiceImpl(<any> tempDir) |
Modifier and Type | Method and Description |
---|---|
java.nio.file.Path |
createTempFile()
Creates a temporary file in the temp directory configured.
|
TempFile |
createWebAccessibleTempFile(java.lang.String id,
User... permittedUsers)
Creates a web-accessible temporary file which can be retrieved by the given
id.
|
TempFile |
createWebAccessibleTempFile(User... permittedUsers)
Creates a temporary file which can be retrieved by the returned identifier
(
TempFile.getWebId() ) using the TempFileServlet . |
TempFile |
getTempFileById(java.lang.String id)
Given an identifier (web-id), retrieves the corresponding temporary file.
|
boolean |
isTmpFile(java.nio.file.Path path)
Checks if the given file is a temporary file, that is, if is located in a
temporary file location.
|
byte[] |
readTmpFileIntoByteArray(java.nio.file.Path path)
Reads all bytes of a given temporary file into a byte array.
|
byte[] |
readTmpFileIntoByteArray(java.nio.file.Path file,
boolean removeFile)
Reads all bytes of a given temporary file into a byte array.
|
public java.nio.file.Path createTempFile() throws java.io.IOException
TempFileService
createTempFile
in interface TempFileService
java.io.IOException
- if an I/O error occurspublic TempFile createWebAccessibleTempFile(java.lang.String id, User... permittedUsers) throws java.io.IOException
TempFileService
createWebAccessibleTempFile
in interface TempFileService
id
- the web-id of the temporary file.permittedUsers
- users allowed to access the temporary filejava.io.IOException
- if an I/O error occurspublic TempFile createWebAccessibleTempFile(User... permittedUsers) throws java.io.IOException
TempFileService
TempFile.getWebId()
) using the TempFileServlet
.createWebAccessibleTempFile
in interface TempFileService
permittedUsers
- users allowed to access the temporary filejava.io.IOException
- if an I/O error occurspublic TempFile getTempFileById(java.lang.String id)
TempFileService
getTempFileById
in interface TempFileService
id
- the web-idpublic byte[] readTmpFileIntoByteArray(java.nio.file.Path path) throws java.io.IOException
TempFileService
readTmpFileIntoByteArray
in interface TempFileService
path
- the temporary file to readjava.io.IOException
- if an I/O error occurspublic byte[] readTmpFileIntoByteArray(java.nio.file.Path file, boolean removeFile) throws java.io.IOException
TempFileService
readTmpFileIntoByteArray
in interface TempFileService
file
- the temporary file to readremoveFile
- true if the temporary file should be deleted after reading
into a byte arrayjava.io.IOException
- if an I/O error occurspublic boolean isTmpFile(java.nio.file.Path path)
TempFileService
isTmpFile
in interface TempFileService
path
- the file to check