CloudBlobDirectory Class

  • java.lang.Object
    • ListBlobItem
      • com.microsoft.azure.storage.blob.CloudBlobDirectory

public class CloudBlobDirectory implements ListBlobItem

Represents a virtual directory of blobs, designated by a delimiter character.

Containers, which are encapsulated as CloudBlobContainer objects, hold directories, and directories hold block blobs and page blobs. Directories can also contain sub-directories.

Constructor Summary

Constructor Description
CloudBlobDirectory(final StorageUri uri, final String prefix, final CloudBlobClient client, final CloudBlobContainer container)

Creates an instance of the class using the specified address, directory parent, and client.

CloudBlobDirectory(final StorageUri uri, final String prefix, final CloudBlobClient client, final CloudBlobContainer container, final CloudBlobDirectory parent)

Creates an instance of the class using the specified address, directory parent, and client.

Method Summary

Modifier and Type Method and Description
CloudAppendBlob getAppendBlobReference(final String blobName)

Returns a reference to a CloudAppendBlob object that represents an append blob in the directory.

CloudAppendBlob getAppendBlobReference(final String blobName, final String snapshotID)

Returns a reference to a CloudAppendBlob object that represents an append blob in the directory, using the specified snapshot ID.

CloudBlockBlob getBlockBlobReference(final String blobName)

Returns a reference to a CloudBlockBlob object that represents a block blob in this directory.

CloudBlockBlob getBlockBlobReference(final String blobName, final String snapshotID)

Returns a reference to a CloudBlockBlob object that represents a block blob in this directory, using the specified snapshot ID.

CloudBlobContainer getContainer()

Returns the container for this directory.

CloudBlobDirectory getDirectoryReference(String directoryName)

Returns a reference to a virtual blob directory beneath this directory.

CloudPageBlob getPageBlobReference(final String blobName)

Returns a reference to a CloudPageBlob object that represents a page blob in the directory.

CloudPageBlob getPageBlobReference(final String blobName, final String snapshotID)

Returns a reference to a CloudPageBlob object that represents a page blob in the directory, using the specified snapshot ID.

CloudBlobDirectory getParent()

Returns the parent directory of this directory.

String getPrefix()

Returns the prefix for this directory.

CloudBlobClient getServiceClient()

Returns the Blob service client associated with this directory.

final StorageUri getStorageUri()

Returns the list of URIs for all locations.

URI getUri()

Returns the URI for this directory.

Iterable<ListBlobItem> listBlobs()

Returns an enumerable collection of blob items for the directory.

Iterable<ListBlobItem> listBlobs(String prefix)

Returns an enumerable collection of blob items whose names begin with the specified prefix for the directory.

Iterable<ListBlobItem> listBlobs(String prefix, final boolean useFlatBlobListing, final EnumSet<BlobListingDetails> listingDetails, final BlobRequestOptions options, final OperationContext opContext)

Returns an enumerable collection of blob items whose names begin with the specified prefix, using the specified flat or hierarchical option, listing details options, request options, and operation context.

ResultSegment<ListBlobItem> listBlobsSegmented()

Returns a result segment of an enumerable collection of blob items in the directory.

ResultSegment<ListBlobItem> listBlobsSegmented(String prefix)

Returns a result segment containing a collection of blob items whose names begin with the specified prefix.

ResultSegment<ListBlobItem> listBlobsSegmented(String prefix, final boolean useFlatBlobListing, final EnumSet<BlobListingDetails> listingDetails, final Integer maxResults, final ResultContinuation continuationToken, final BlobRequestOptions options, final OperationContext opContext)

Returns a result segment containing a collection of blob items whose names begin with the specified prefix, using the specified flat or hierarchical option, listing details options, request options, and operation context.

Constructor Details

CloudBlobDirectory

protected CloudBlobDirectory(final StorageUri uri, final String prefix, final CloudBlobClient client, final CloudBlobContainer container)

Creates an instance of the class using the specified address, directory parent, and client.

Parameters:

uri - A StorageUri that represents the blob directory's address.
prefix - A String that represents the blob directory's prefix.
client - A CloudBlobClient object that represents the associated service client.
container

CloudBlobDirectory

protected CloudBlobDirectory(final StorageUri uri, final String prefix, final CloudBlobClient client, final CloudBlobContainer container, final CloudBlobDirectory parent)

Creates an instance of the class using the specified address, directory parent, and client.

Parameters:

uri - A StorageUri that represents the blob directory's address.
prefix - A String that represents the blob directory's prefix.
client - A CloudBlobClient object that represents the associated service client.
container
parent - A CloudBlobDirectory object that represents the parent directory, if applicable.

Method Details

getAppendBlobReference

public CloudAppendBlob getAppendBlobReference(final String blobName)

Returns a reference to a CloudAppendBlob object that represents an append blob in the directory.

Parameters:

blobName - A String that represents the name of the blob.

Returns:

A CloudAppendBlob object that represents a reference to the specified append blob.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

getAppendBlobReference

public CloudAppendBlob getAppendBlobReference(final String blobName, final String snapshotID)

Returns a reference to a CloudAppendBlob object that represents an append blob in the directory, using the specified snapshot ID.

Parameters:

blobName - A String that represents the name of the blob.
snapshotID - A String that represents the snapshot ID of the blob.

Returns:

A CloudAppendBlob object that represents a reference to the specified append blob.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

getBlockBlobReference

public CloudBlockBlob getBlockBlobReference(final String blobName)

Returns a reference to a CloudBlockBlob object that represents a block blob in this directory.

Parameters:

blobName - A String that represents the name of the blob.

Returns:

A CloudBlockBlob object that represents a reference to the specified block blob.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

getBlockBlobReference

public CloudBlockBlob getBlockBlobReference(final String blobName, final String snapshotID)

Returns a reference to a CloudBlockBlob object that represents a block blob in this directory, using the specified snapshot ID.

Parameters:

blobName - A String that represents the name of the blob.
snapshotID - A String that represents the snapshot ID of the blob.

Returns:

A CloudBlockBlob object that represents a reference to the specified block blob.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

getContainer

public CloudBlobContainer getContainer()

Returns the container for this directory.

Overrides:

CloudBlobDirectory.getContainer()

Returns:

A CloudBlobContainer that represents the container for this directory.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

getDirectoryReference

public CloudBlobDirectory getDirectoryReference(String directoryName)

Returns a reference to a virtual blob directory beneath this directory.

Parameters:

directoryName - A String that represents the name of the virtual subdirectory.

Returns:

A CloudBlobDirectory object that represents a virtual blob directory beneath this directory.

Throws:

URISyntaxException - If the resource URI is invalid.

getPageBlobReference

public CloudPageBlob getPageBlobReference(final String blobName)

Returns a reference to a CloudPageBlob object that represents a page blob in the directory.

Parameters:

blobName - A String that represents the name of the blob.

Returns:

A CloudPageBlob object that represents a reference to the specified page blob.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

getPageBlobReference

public CloudPageBlob getPageBlobReference(final String blobName, final String snapshotID)

Returns a reference to a CloudPageBlob object that represents a page blob in the directory, using the specified snapshot ID.

Parameters:

blobName - A String that represents the name of the blob.
snapshotID - A String that represents the snapshot ID of the blob.

Returns:

A CloudPageBlob object that represents a reference to the specified page blob.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

getParent

public CloudBlobDirectory getParent()

Returns the parent directory of this directory.

Overrides:

CloudBlobDirectory.getParent()

Returns:

A CloudBlobDirectory object that represents the parent of this directory.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

getPrefix

public String getPrefix()

Returns the prefix for this directory.

Returns:

A String that represents the prefix for this directory.

getServiceClient

public CloudBlobClient getServiceClient()

Returns the Blob service client associated with this directory.

Returns:

An CloudBlobClient object that represents the service client associated with the directory.

getStorageUri

public final StorageUri getStorageUri()

Returns the list of URIs for all locations.

Overrides:

CloudBlobDirectory.getStorageUri()

Returns:

A StorageUri that represents the list of URIs for all locations..

getUri

public URI getUri()

Returns the URI for this directory.

Overrides:

CloudBlobDirectory.getUri()

Returns:

A java.net.URI object that represents the URI for this directory.

listBlobs

public Iterable listBlobs()

Returns an enumerable collection of blob items for the directory.

Returns:

An enumerable collection of ListBlobItem objects that represent the block items in this container.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

listBlobs

public Iterable listBlobs(String prefix)

Returns an enumerable collection of blob items whose names begin with the specified prefix for the directory.

Parameters:

prefix - A String that represents the blob name prefix.

Returns:

An enumerable collection of ListBlobItem objects that represent the block items whose names begin with the specified prefix in this directory.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

listBlobs

public Iterable listBlobs(String prefix, final boolean useFlatBlobListing, final EnumSet listingDetails, final BlobRequestOptions options, final OperationContext opContext)

Returns an enumerable collection of blob items whose names begin with the specified prefix, using the specified flat or hierarchical option, listing details options, request options, and operation context.

Parameters:

prefix - A String that represents the prefix of the blob name.
useFlatBlobListing -

true to indicate that the returned list will be flat; false to indicate that the returned list will be hierarchical.

listingDetails - A java.util.EnumSet object that contains BlobListingDetails values that indicate whether snapshots, metadata, and/or uncommitted blocks are returned. Committed blocks are always returned.
options - A BlobRequestOptions object that specifies any additional options for the request. Specifying null will use the default request options from the associated service client ( CloudBlobClient).
opContext - An OperationContext object that represents the context for the current operation. This object is used to track requests to the storage service, and to provide additional runtime information about the operation.

Returns:

An enumerable collection of ListBlobItem objects that represent the block items whose names begin with the specified prefix in this directory.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

listBlobsSegmented

public ResultSegment listBlobsSegmented()

Returns a result segment of an enumerable collection of blob items in the directory.

Returns:

A ResultSegment<T> object that contains a segment of the enumerable collection of ListBlobItem objects that represent the blob items in the directory.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

listBlobsSegmented

public ResultSegment listBlobsSegmented(String prefix)

Returns a result segment containing a collection of blob items whose names begin with the specified prefix.

Parameters:

prefix - A String that represents the prefix of the blob name.

Returns:

A ResultSegment<T> object that contains a segment of the enumerable collection of ListBlobItem objects that represent the blob items whose names begin with the specified prefix in the directory.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

listBlobsSegmented

public ResultSegment listBlobsSegmented(String prefix, final boolean useFlatBlobListing, final EnumSet listingDetails, final Integer maxResults, final ResultContinuation continuationToken, final BlobRequestOptions options, final OperationContext opContext)

Returns a result segment containing a collection of blob items whose names begin with the specified prefix, using the specified flat or hierarchical option, listing details options, request options, and operation context.

Parameters:

prefix - A String that represents the prefix of the blob name.
useFlatBlobListing -

true to indicate that the returned list will be flat; false to indicate that the returned list will be hierarchical.

listingDetails - A java.util.EnumSet object that contains BlobListingDetails values that indicate whether snapshots, metadata, and/or uncommitted blocks are returned. Committed blocks are always returned.
maxResults - The maximum number of results to retrieve.
continuationToken - A ResultContinuation object that represents a continuation token returned by a previous listing operation.
options - A BlobRequestOptions object that specifies any additional options for the request. Specifying null will use the default request options from the associated service client ( CloudBlobClient).
opContext - An OperationContext object that represents the context for the current operation. This object is used to track requests to the storage service, and to provide additional runtime information about the operation.

Returns:

A ResultSegment<T> object that contains a segment of the enumerable collection of ListBlobItem objects that represent the block items whose names begin with the specified prefix in the directory.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException - If the resource URI is invalid.

Applies to