Class FileStorageService
java.lang.Object
edu.ntnu.idatt2106_2023_06.backend.service.files.FileStorageService
- All Implemented Interfaces:
IFileStorageService
Service for handling file uploads. The service will store the files in the directory src/main/resources/images.
- Version:
- 1.0
- Author:
- Brage H. Kvamme
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
byte[]
getProfilePicture
(long imageId) void
setFileStorageLocation
(Path fileStorageLocation) Sets the file storage location.void
storeProfilePicture
(String userId, org.springframework.web.multipart.MultipartFile profilePicture)
-
Constructor Details
-
FileStorageService
Constructor for the FileStorageService. The file storage location is set to src/main/resources/images.- Throws:
IOException
-
-
Method Details
-
setFileStorageLocation
Sets the file storage location. This method is used for testing purposes.- Parameters:
fileStorageLocation
- The file storage location.
-
storeProfilePicture
public void storeProfilePicture(String userId, org.springframework.web.multipart.MultipartFile profilePicture) throws IOException - Specified by:
storeProfilePicture
in interfaceIFileStorageService
- Throws:
IOException
-
deleteProfilePicture
- Specified by:
deleteProfilePicture
in interfaceIFileStorageService
- Throws:
IOException
-
getProfilePicture
public byte[] getProfilePicture(long imageId) - Specified by:
getProfilePicture
in interfaceIFileStorageService
-