Package com.ultikits.ultitools.utils
Class HttpDownloadUtils
java.lang.Object
com.ultikits.ultitools.utils.HttpDownloadUtils
Utility class for HTTP file download operations.
Provides methods to download files from URLs with progress tracking support.
HTTP文件下载操作的实用工具类。 提供从URL下载文件的方法,支持进度跟踪。
HTTP文件下载操作的实用工具类。 提供从URL下载文件的方法,支持进度跟踪。
- Since:
- 6.0.0
- Author:
- wisdomme
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProgress callback interface for download operations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDownload file from URL.static voiddownload(String urlString, String fileName, String savePath, HttpDownloadUtils.ProgressCallback progressCallback) Download file from URL with progress callback.static byte[]downloadToByteArray(String urlString) Download content from URL to byte array.
-
Constructor Details
-
HttpDownloadUtils
public HttpDownloadUtils()
-
-
Method Details
-
download
Download file from URL.
从URL下载文件。- Parameters:
urlString- Download URL
下载地址fileName- File name
文件名savePath- Save path
保存路径- Throws:
IOException- if an I/O error occurs during download
-
download
public static void download(String urlString, String fileName, String savePath, HttpDownloadUtils.ProgressCallback progressCallback) throws IOException Download file from URL with progress callback.
从URL下载文件并提供进度回调。- Parameters:
urlString- Download URL
下载地址fileName- File name
文件名savePath- Save path
保存路径progressCallback- Progress callback
进度回调- Throws:
IOException- if an I/O error occurs during download
-
downloadToByteArray
Download content from URL to byte array.
从URL下载内容到字节数组。- Parameters:
urlString- Download URL
下载地址- Returns:
- Downloaded content as byte array
下载的内容作为字节数组 - Throws:
IOException- if an I/O error occurs during download
-