javaazure-blob-storageibm-cloud-storage

Analogue of IBM COS ListObjectsV2 on Azure Blob Storage


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


Solution

  • 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:

    enter image description here

    Java v12 SDK allows you to interact with Containers and Blobs. This SDK provides classes to interact with these resources:

    For code example to work with these classes, please visit here.