本文整理汇总了Java中com.microsoft.azure.storage.blob.CloudBlobContainer.listBlobs方法的典型用法代码示例。如果您正苦于以下问题:Java CloudBlobContainer.listBlobs方法的具体用法?Java CloudBlobContainer.listBlobs怎么用?Java CloudBlobContainer.listBlobs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.microsoft.azure.storage.blob.CloudBlobContainer
的用法示例。
在下文中一共展示了CloudBlobContainer.listBlobs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listObjects
import com.microsoft.azure.storage.blob.CloudBlobContainer; //导入方法依赖的package包/类
/**
* For a set of remote storage objects under a remote location and a given prefix/path
* returns their properties wrapped in ObjectSummary objects
*
* @param remoteStorageLocation location, i.e. container for Azure
* @param prefix the prefix/path to list under
* @return a collection of storage summary objects
* @throws StorageProviderException Azure storage exception
*/
@Override
public StorageObjectSummaryCollection listObjects(String remoteStorageLocation, String prefix)
throws StorageProviderException
{
StorageObjectSummaryCollection storageObjectSummaries;
try
{
CloudBlobContainer container = azStorageClient.getContainerReference(remoteStorageLocation);
Iterable<ListBlobItem> listBlobItemIterable = container.listBlobs(
prefix, // List the BLOBs under this prefix
true // List the BLOBs as a flat list, i.e. do not list directories
);
storageObjectSummaries = new StorageObjectSummaryCollection(listBlobItemIterable);
}
catch (URISyntaxException | StorageException ex)
{
logger.debug("Failed to list objects: {}", ex);
throw new StorageProviderException(ex);
}
return storageObjectSummaries;
}
示例2: getSnapshotFileKeys
import com.microsoft.azure.storage.blob.CloudBlobContainer; //导入方法依赖的package包/类
private Map<String, Long> getSnapshotFileKeys(CloudBlobContainer container, String keyPrefix) {
Map<String, Long> snapshotFiles = new HashMap<>();
try {
for (ListBlobItem item : container.listBlobs(keyPrefix, true)) {
if (item instanceof CloudPageBlob) {
CloudPageBlob cloudBlob = (CloudPageBlob) item;
snapshotFiles.put(cloudBlob.getName(), getOriginalFileSize(cloudBlob));
}
}
} catch (StorageException e) {
logger.error("Unable to retrieve metadata.", e);
// all or none
snapshotFiles = new HashMap<>();
}
return snapshotFiles;
}
示例3: listImages
import com.microsoft.azure.storage.blob.CloudBlobContainer; //导入方法依赖的package包/类
public String[] listImages() throws Exception {
CloudBlobContainer container = getContainer();
Iterable<ListBlobItem> blobs = container.listBlobs();
LinkedList<String> blobNames = new LinkedList<>();
for (ListBlobItem blob : blobs) {
blobNames.add(((CloudBlockBlob) blob).getName());
}
return blobNames.toArray(new String[blobNames.size()]);
}
示例4: listAllBlobbs
import com.microsoft.azure.storage.blob.CloudBlobContainer; //导入方法依赖的package包/类
public static List<String> listAllBlobbs(String containerName){
List<String> blobsList = new ArrayList<>();
CloudBlobContainer container = AzureConnectionManager.getContainer(containerName,true);
// Loop over blobs within the container and output the URI to each of them.
for (ListBlobItem blobItem : container.listBlobs()) {
blobsList.add(blobItem.getUri().toString());
}
return blobsList;
}
示例5: ListImages
import com.microsoft.azure.storage.blob.CloudBlobContainer; //导入方法依赖的package包/类
public static String[] ListImages() throws Exception{
CloudBlobContainer container = getContainer();
Iterable<ListBlobItem> blobs = container.listBlobs();
LinkedList<String> blobNames = new LinkedList<>();
for(ListBlobItem blob: blobs) {
blobNames.add(((CloudBlockBlob) blob).getName());
}
return blobNames.toArray(new String[blobNames.size()]);
}
示例6: listBlobs
import com.microsoft.azure.storage.blob.CloudBlobContainer; //导入方法依赖的package包/类
@NotNull
public static String listBlobs(@NotNull final StorageInputs inputs) throws Exception {
final CloudBlobClient blobClient = getCloudBlobClient(inputs);
final CloudBlobContainer container = blobClient.getContainerReference(inputs.getContainerName());
final List<String> blobList = new ArrayList<>();
for (final ListBlobItem blobItem : container.listBlobs()) {
final String path = blobItem.getUri().getPath();
blobList.add(path.substring(path.lastIndexOf(FORWARD_SLASH) + 1));
}
return StringUtilities.join(blobList, COMMA);
}
示例7: listBlobs
import com.microsoft.azure.storage.blob.CloudBlobContainer; //导入方法依赖的package包/类
public Iterable<ListBlobItem> listBlobs(final String containerName, final String prefix, final boolean useFlatBlobListing)
throws URISyntaxException, StorageException, InvalidKeyException {
CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName);
return cloudBlobContainer.listBlobs(prefix, useFlatBlobListing);
}