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 TypeMethodDescriptionvoidbyte[]getProfilePicture(long imageId) voidsetFileStorageLocation(Path fileStorageLocation) Sets the file storage location.voidstoreProfilePicture(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:
storeProfilePicturein interfaceIFileStorageService- Throws:
IOException
-
deleteProfilePicture
- Specified by:
deleteProfilePicturein interfaceIFileStorageService- Throws:
IOException
-
getProfilePicture
public byte[] getProfilePicture(long imageId) - Specified by:
getProfilePicturein interfaceIFileStorageService
-