Good day. I've the following code snippet for interacting with IBM Cloud Storage in Java:
ListObjectsV2Request request = new ListObjectsV2Request()
.withBucketName(bucket)
.withPrefix(prefix)
.withMaxKey(keyCount)
.withContinuationToken(token)
.withSdkClientExecutionTimeut(timeout);
ListObjectsV2Result result = cosConfig.getClient().listObjectsV2(request);
result.getObjectSummaries()
.stream()
.filter(e -> e.getKey().endsWith(extension))
.forEach(e -> map.put(
e.getKey().substring(e.getKey().lastIndexOf("/") + 1),
e.getETag()
));
if (result.isTruncated()) {
token = result.getNextContinuationToken();
}
But can't find exact alternative on Azure Blob. Do I understand correctly that it's easier to get a container and then find the necessary ones in the list of blobs?
Thanks a lot
Do I understand correctly that it's easier to get a container and then find the necessary ones in the list of blobs?
Yes, that's correct. This is the exact hierarchy of Azure Blob Storage.
Azure Blob Storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that does not adhere to a particular data model or definition, such as text or binary data. Blob storage offers three types of resources:
Java v12 SDK allows you to interact with Containers
and Blobs
. This SDK provides classes to interact with these resources:
BlobServiceClient
class allows you to manipulate Azure Storage resources and blob containers. The storage account provides the top-level namespace for the Blob service.BlobServiceClientBuilder
class provides a fluent builder API to help aid the configuration and instantiation of BlobServiceClient
objects.BlobContainerClient
class allows you to manipulate Azure Storage containers and their blobs.BlobClient
class allows you to manipulate Azure Storage blobs.BlobItem
class represents individual blobs returned from a call to listBlobs
.For code example to work with these classes, please visit here.