Package org.teleight.teleightbots.files
Interface FileDownloader
- All Superinterfaces:
AutoCloseable,Closeable
Interface for a File Downloader that provides methods for downloading files from a given path or a Telegram File object.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@NotNull CompletableFuture<File> downloadFile(@NotNull String filePath) Downloads a file from a given file path.@NotNull CompletableFuture<File> downloadFile(@NotNull String filePath, File outputFile) Downloads a file from a given file path and writes it to a specified output file.@NotNull CompletableFuture<File> downloadFile(@NotNull File telegramFile) Downloads a file from a given Telegram File object.@NotNull CompletableFuture<File> downloadFile(@NotNull File telegramFile, File outputFile) Downloads a file from a given Telegram File object and writes it to a specified output file.static @NotNull FileDownloadernewFileDownloader(@NotNull TelegramBot bot)
-
Field Details
-
FILE_DOWNLOAD_TEMPLATE
- See Also:
-
-
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 downloadedoutputFile- 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 downloadedoutputFile- the file to which the downloaded file will be written- Returns:
- a CompletableFuture that will complete with the downloaded file
-