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
TempFileServicecreateTempFile in interface TempFileServicejava.io.IOException - if an I/O error occurspublic TempFile createWebAccessibleTempFile(java.lang.String id, User... permittedUsers) throws java.io.IOException
TempFileServicecreateWebAccessibleTempFile in interface TempFileServiceid - 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
TempFileServiceTempFile.getWebId()) using the TempFileServlet.createWebAccessibleTempFile in interface TempFileServicepermittedUsers - users allowed to access the temporary filejava.io.IOException - if an I/O error occurspublic TempFile getTempFileById(java.lang.String id)
TempFileServicegetTempFileById in interface TempFileServiceid - the web-idpublic byte[] readTmpFileIntoByteArray(java.nio.file.Path path)
throws java.io.IOException
TempFileServicereadTmpFileIntoByteArray in interface TempFileServicepath - 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
TempFileServicereadTmpFileIntoByteArray in interface TempFileServicefile - 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)
TempFileServiceisTmpFile in interface TempFileServicepath - the file to check