【发布时间】:2020-10-14 22:37:38
【问题描述】:
我想从 Azure blob 存储下载一个大尺寸的 blob。假设我的 blob 大小为 2 GB。我想使用java-sdk 以百分比形式获取下载进度,以便显示一些漂亮的进度条。我正在使用以下代码下载 blob
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder().connectionString("connectionString").buildClient();
BlobContainerClient blobContainerClient = blobServiceClient.getBlobContainerClient("cloudDirectoryName");
BlobClient blobClient = blobContainerClient.getBlobClient(fileName);
BlobRange range = new BlobRange(1024, 2048L);
DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5);
blobClient.downloadToFileWithResponse(filePath, null, new ParallelTransferOptions(4 * Constants.MB, null, null),
options, null, false, null, null);
【问题讨论】:
标签: java azure azure-storage azure-java-sdk