public interface FileService
| Modifier and Type | Method and Description |
|---|---|
void |
delete(Long fileId) |
void |
deleteUnreferenced() |
Optional<FileData> |
fetch(Long fileId) |
default FileUploaded |
upload(FileType fileType,
byte[] fileData) |
FileUploaded |
upload(FileType fileType,
byte[] fileData,
String fileName)
Save an uploaded file.
|
default Optional<FileUploaded> |
upload(FileType fileType,
FileUploadBase64 file) |
default FileUploaded |
upload(FileType fileType,
InputStream fileData)
Consume the stream to produce a byte array,
then call
#upload(byte[], String, EntityManager)) |
default FileUploaded |
upload(FileType fileType,
InputStream fileData,
String fileName)
Consume the stream to produce a byte array,
then call
#upload(byte[], String, EntityManager)) |
Optional<String> |
url(Long fileId)
Returns a complete relative URL, for example /api/files/3418557718705733633/cats.jpg
Optional.empty() is returned if the corresponding file does not exist |
String |
urlRaw(Long fileId)
Returns a relative URL without the extension.
|
FileUploaded upload(FileType fileType, byte[] fileData, @Nullable String fileName)
default FileUploaded upload(FileType fileType, byte[] fileData)
default Optional<FileUploaded> upload(FileType fileType, @Nullable FileUploadBase64 file)
default FileUploaded upload(FileType fileType, InputStream fileData)
#upload(byte[], String, EntityManager))default FileUploaded upload(FileType fileType, InputStream fileData, String fileName)
#upload(byte[], String, EntityManager))void delete(Long fileId)
void deleteUnreferenced()
Optional<String> url(Long fileId)
Optional.empty() is returned if the corresponding file does not existString urlRaw(Long fileId)
url(Long),
it does not make a call to the database to compute the file URL.
For example, returns /api/file/3418557718705733633Copyright © 2018 Coreoz. All rights reserved.