Class FileService


  • @Service
    public class FileService
    extends Object
    Class represent service which is responsible for images operations
    • Field Detail

      • separator

        public static final String separator
        Separator that can occur at the beginning of base64 string
        See Also:
        Constant Field Values
    • Constructor Detail

      • FileService

        public FileService()
    • Method Detail

      • detectType

        public String detectType​(byte[] fileArr)
        Detects the type of file
        Parameters:
        fileArr - bytes of file
        Returns:
        detected type
      • saveInstitutionImage

        public String saveInstitutionImage​(String encodedImage)
                                    throws Exception
        Saves given institution image and returns its name
        Parameters:
        encodedImage - base64 encoded image
        Returns:
        saved image name
        Throws:
        Exception
      • deleteInstitutionImage

        public void deleteInstitutionImage​(String image)
        Deletes institution image
        Parameters:
        image - name
      • saveExhibitImage

        public String saveExhibitImage​(String encodedImage)
                                throws Exception
        Saves given exhibit image and returns its name
        Parameters:
        encodedImage - base64 encoded image
        Returns:
        saved image name
        Throws:
        Exception
      • deleteExhibitImage

        public void deleteExhibitImage​(String image)
        Delete exhibit image
        Parameters:
        image - name
      • saveInfoLabelImage

        public String saveInfoLabelImage​(String encodedInfoLabel)
                                  throws Exception
        Saves given info label image and returns its name
        Parameters:
        encodedInfoLabel - base64 encoded image
        Returns:
        saved image name
        Throws:
        Exception
      • deleteInfoLabelImage

        public void deleteInfoLabelImage​(String image)
        Delete info label image
        Parameters:
        image - name