Class FileService

java.lang.Object
com.samupert.univpm.eurostat.common.service.FileService

@Service public class FileService extends Object
Service for handling file operations.
  • Constructor Details

    • FileService

      public FileService()
  • Method Details

    • download

      public File download(String url, String prefix, String suffix) throws DownloadFileException
      Downloads the file from the provided url to a temporary file.
      Parameters:
      url - The URL of the file to download.
      prefix - The prefix of the temporary file.
      suffix - The suffix of the temporary file.
      Returns:
      The downloaded File.
      Throws:
      DownloadFileException - Thrown when the download fails.
    • gunzipFile

      public File gunzipFile(File zippedFile, String prefix, String suffix) throws FileNotFoundException, GunzipFileException
      Extract the provided zipped file to a temporary file.
      Parameters:
      zippedFile - The zipped file to extract.
      prefix - The prefix of the temporary file.
      suffix - The suffix of the temporary file.
      Returns:
      The extracted file.
      Throws:
      FileNotFoundException - Thrown when the provided file does not exist.
      GunzipFileException - Thrown when there's an error in the extraction process.