Interface FileDownloader

All Superinterfaces:
AutoCloseable, Closeable

public sealed interface FileDownloader extends Closeable
Interface for a File Downloader that provides methods for downloading files from a given path or a Telegram File object.
  • Field Details

  • Method Details

    • newFileDownloader

      @Internal @NotNull static @NotNull FileDownloader newFileDownloader(@NotNull @NotNull TelegramBot bot)
    • downloadFile

      @NotNull @NotNull CompletableFuture<File> downloadFile(@NotNull @NotNull String filePath) throws DownloadFileException
      Downloads a file from a given file path.
      Parameters:
      filePath - the path of the file to be downloaded
      Returns:
      a CompletableFuture that will complete with the downloaded file
      Throws:
      DownloadFileException - if an error occurs during the file download
    • downloadFile

      @NotNull @NotNull CompletableFuture<File> downloadFile(@NotNull @NotNull File telegramFile) throws DownloadFileException
      Downloads a file from a given Telegram File object.
      Parameters:
      telegramFile - the Telegram File object representing the file to be downloaded
      Returns:
      a CompletableFuture that will complete with the downloaded file
      Throws:
      DownloadFileException - if an error occurs during the file download
    • downloadFile

      @NotNull @NotNull CompletableFuture<File> downloadFile(@NotNull @NotNull File telegramFile, @NotNull File outputFile) throws DownloadFileException
      Downloads a file from a given Telegram File object and writes it to a specified output file.
      Parameters:
      telegramFile - the Telegram File object representing the file to be downloaded
      outputFile - the file to which the downloaded file will be written
      Returns:
      a CompletableFuture that will complete with the downloaded file
      Throws:
      DownloadFileException - if an error occurs during the file download
    • downloadFile

      @NotNull @NotNull CompletableFuture<File> downloadFile(@NotNull @NotNull String filePath, File outputFile)
      Downloads a file from a given file path and writes it to a specified output file.
      Parameters:
      filePath - the path of the file to be downloaded
      outputFile - the file to which the downloaded file will be written
      Returns:
      a CompletableFuture that will complete with the downloaded file