In our Azure portal I have created a storage account and inside created a blob container and inside that a blob which is just a simple text file. I have also set the some random metadata fields on the blob seen here.
In my java code when I access the blob via the Azure SDK I can print the content of the blob, I can acccess the blob properties like the Etag and I can access the container metadata. But I cannot print the blob metadata fields seen above. Specifically this code taken from the samples page doesn't print anything since the received HashMap from blob.getMetadata()
method is empty.
System.out.println("Get blob metadata:");
HashMap<String, String> metadata = blob.getMetadata();
Iterator it = metadata.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry) it.next();
System.out.printf(" %s = %s%n", pair.getKey(), pair.getValue());
it.remove();
}
If I instead make a REST API call to the blob and ask for the metadata fields I do get them back as HTTP headers. However I would like to access them via the SDK if possible.