public interface BlobDataIterator extends Iterator<InputStream>, AutoCloseable
此迭代器是 AutoCloseable 的,必须在 try-with-resources 语句中使用,
以确保底层网络连接等资源在操作完成或发生错误时被正确关闭。
在迭代过程中,如果下载或解析失败,Iterator.hasNext() 或 next()
方法会抛出 BlobDownloadException。
示例用法:
try (BlobDataIterator iterator = blobManager.batchDownload(blobs)) {
while (iterator.hasNext()) {
try (InputStream blobContentStream = iterator.next()) {
// 处理 blobContentStream...
}
}
} catch (BlobDownloadException e) {
// 处理下载中断...
}
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
InputStream |
next() |
forEachRemaining, hasNext, removeInputStream next()
next in interface Iterator<InputStream>void close()
throws IOException
close in interface AutoCloseableIOExceptionCopyright © 2026 Alibaba Cloud Computing. All rights reserved.