CloudBlockBlob Class

public class CloudBlockBlob extends CloudBlob

Represents a blob that is uploaded as a set of blocks.

Constructor Summary

Constructor Description
CloudBlockBlob(final CloudBlockBlob otherBlob)

Creates an instance of the class by copying values from another cloud block blob.

CloudBlockBlob(final StorageUri blobAbsoluteUri)

Creates an instance of the class using the specified absolute StorageUri.

CloudBlockBlob(final StorageUri blobAbsoluteUri, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute StorageUri and credentials.

CloudBlockBlob(final StorageUri blobAbsoluteUri, final String snapshotID, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute StorageUri, snapshot ID, and credentials.

CloudBlockBlob(final URI blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI.

CloudBlockBlob(final URI blobAbsoluteUri, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute URI and credentials.

CloudBlockBlob(final URI blobAbsoluteUri, final String snapshotID, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute URI, snapshot ID, and credentials.

CloudBlockBlob(String blobName, String snapshotID, CloudBlobContainer container)

Creates an instance of the class using the specified type, name, snapshot ID, and container.

Method Summary

Modifier and Type Method and Description
void commitBlockList(final Iterable<BlockEntry> blockList)

Commits a block list to the storage service. In order to be written as part of a blob, a block must have been successfully written to the server in a prior uploadBlock operation.

void commitBlockList(final Iterable<BlockEntry> blockList, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Commits a block list to the storage service using the specified lease ID, request options, and operation context. In order to be written as part of a blob, a block must have been successfully written to the server in a prior uploadBlock operation.

void commitBlockList(final Iterable<BlockEntry> blockList, StandardBlobTier standardBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Commits a block list to the storage service using the specified lease ID, request options, and operation context. In order to be written as part of a blob, a block must have been successfully written to the server in a prior uploadBlock operation.

void createBlockFromURI(final String blockId, final URI copySource, final Long offset, final Long length)

Creates a block to be committed as part of the block blob, using the specified block ID and the source URL.

void createBlockFromURI(final String blockId, final URI copySource, final Long offset, final Long length, String md5, final AccessCondition sourceAccessCondition, BlobRequestOptions options, OperationContext opContext)

Creates a block to be committed as part of the block blob, using the specified block ID, the specified source URL, the specified lease ID, request options, and operation context.

ArrayList<BlockEntry> downloadBlockList()

Downloads the committed block list from the block blob.

The committed block list includes the list of blocks that have been successfully committed to the block blob. The list of committed blocks is returned in the same order that they were committed to the blob. No block may appear more than once in the committed block list.

ArrayList<BlockEntry> downloadBlockList(final BlockListingFilter blockListingFilter, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Downloads the block list from the block blob using the specified block listing filter, request options, and operation context.

The committed block list includes the list of blocks that have been successfully committed to the block blob. The list of committed blocks is returned in the same order that they were committed to the blob. No block may appear more than once in the committed block list.

String downloadText()

Downloads a blob to a string using the platform's default encoding.

String downloadText(final String charsetName, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Downloads a blob to a string using the specified encoding.

boolean isStreamWriteSizeModified()

Gets the flag that indicates whether the default streamWriteSize was modified.

BlobOutputStream openOutputStream()

Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, it will be overwritten.

To avoid overwriting and instead throw an error, please use the openOutputStream(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) overload with the appropriate AccessCondition.

BlobOutputStream openOutputStream(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Creates and opens an output stream to write data to the block blob using the specified request options and operation context. If the blob already exists on the service, it will be overwritten.

To avoid overwriting and instead throw an error, please pass in an AccessCondition generated using generateIfNotExistsCondition().

void setStreamWriteSizeInBytes(final int streamWriteSizeInBytes)

Sets the number of bytes to buffer when writing to a BlobOutputStream.

final String startCopy(final CloudBlockBlob sourceBlob)

Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob.

final String startCopy(final CloudBlockBlob sourceBlob, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob, using the specified access conditions, lease ID, request options, and operation context.

final String startCopy(final CloudBlockBlob sourceBlob, String contentMd5, boolean syncCopy, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob, using the specified access conditions, lease ID, request options, and operation context.

final String startCopy(final CloudBlockBlob sourceBlob, String contentMd5, boolean syncCopy, final StandardBlobTier standardBlobTier, RehydratePriority rehydratePriority, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob, using the blob tier, rehydrate priority, specified access conditions, lease ID, request options, operation context.

final String startCopy(final CloudFile sourceFile)

Requests the service to start copying a file's contents, properties, and metadata to a new block blob.

final String startCopy(final CloudFile sourceFile, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a file's contents, properties, and metadata to a new block blob, using the specified access conditions, lease ID, request options, and operation context.

void upload(final InputStream sourceStream, final long length)

Uploads the source stream data to the block blob. If the blob already exists on the service, it will be overwritten.

void upload(final InputStream sourceStream, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads the source stream data to the blob, using the specified lease ID, request options, and operation context. If the blob already exists on the service, it will be overwritten.

void upload(final InputStream sourceStream, final long length, final StandardBlobTier standardBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads the source stream data to the blob, using the specified lease ID, request options, and operation context. If the blob already exists on the service, it will be overwritten.

void uploadBlock(final String blockId, final InputStream sourceStream, final long length)

Uploads a block to be committed as part of the block blob, using the specified block ID.

void uploadBlock(final String blockId, final InputStream sourceStream, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a block to be committed as part of the block blob, using the specified block ID, the specified lease ID, request options, and operation context.

void uploadFromByteArray(final byte[] buffer, final int offset, final int length, final StandardBlobTier standardBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a blob from data in a byte array. If the blob already exists on the service, it will be overwritten.

final void uploadFullBlob(final InputStream sourceStream, final long length, final StandardBlobTier standardBlobTier, final AccessCondition accessCondition, final BlobRequestOptions options, final OperationContext opContext)

Uploads a blob in a single operation.

void uploadStandardBlobTier(final StandardBlobTier standardBlobTier)

Sets the blob tier on a block blob on a standard storage account.

void uploadStandardBlobTier(final StandardBlobTier standardBlobTier, BlobRequestOptions options, OperationContext opContext)

Sets the tier on a block blob on a standard storage account.

void uploadStandardBlobTier(final StandardBlobTier standardBlobTier, RehydratePriority rehydratePriority, BlobRequestOptions options, OperationContext opContext)

Sets the tier on a block blob on a standard storage account.

void uploadText(final String content)

Uploads a blob from a string using the platform's default encoding. If the blob already exists on the service, it will be overwritten.

void uploadText(final String content, final String charsetName, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a blob from a string using the specified encoding. If the blob already exists on the service, it will be overwritten.

void uploadText(final String content, final String charsetName, final StandardBlobTier standardBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a blob from a string using the specified encoding. If the blob already exists on the service, it will be overwritten.

Inherited Members

CloudBlob.abortCopy(final String copyId) CloudBlob.abortCopy(final String copyId, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.acquireLease() CloudBlob.acquireLease(final Integer leaseTimeInSeconds, final String proposedLeaseId) CloudBlob.acquireLease(final Integer leaseTimeInSeconds, final String proposedLeaseId, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.assertCorrectBlobType() CloudBlob.assertNoWriteOperationForSnapshot() CloudBlob.blobServiceClient CloudBlob.breakLease(final Integer breakPeriodInSeconds) CloudBlob.breakLease(final Integer breakPeriodInSeconds, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.changeLease(final String proposedLeaseId, final AccessCondition accessCondition) CloudBlob.changeLease(final String proposedLeaseId, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.CloudBlob(final BlobType type, String blobName, String snapshotID, CloudBlobContainer container) CloudBlob.CloudBlob(final BlobType type, final StorageUri uri, final String snapshotID, final StorageCredentials credentials) CloudBlob.CloudBlob(final CloudBlob otherBlob) CloudBlob.createSnapshot() CloudBlob.createSnapshot(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.createSnapshot(final HashMap<String, String> metadata, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.delete() CloudBlob.delete(final DeleteSnapshotsOption deleteSnapshotsOption, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.deleteIfExists() CloudBlob.deleteIfExists(final DeleteSnapshotsOption deleteSnapshotsOption, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.download(final OutputStream outStream) CloudBlob.download(final OutputStream outStream, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadAccountInfo() CloudBlob.downloadAccountInfo(BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadAccountInformationImpl(final RequestOptions options) CloudBlob.downloadAttributes() CloudBlob.downloadAttributes(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadRange(final long offset, final Long length, final OutputStream outStream) CloudBlob.downloadRange(final long offset, final Long length, final OutputStream outStream, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadRangeInternal(final long blobOffset, final Long length, final byte[] buffer, final int bufferOffset, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadRangeToByteArray(final long offset, final Long length, final byte[] buffer, final int bufferOffset) CloudBlob.downloadRangeToByteArray(final long offset, final Long length, final byte[] buffer, final int bufferOffset, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadToByteArray(final byte[] buffer, final int bufferOffset) CloudBlob.downloadToByteArray(final byte[] buffer, final int bufferOffset, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadToFile(final String path) CloudBlob.downloadToFile(final String path, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.exists() CloudBlob.exists(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final String groupPolicyIdentifier) CloudBlob.generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers, final String groupPolicyIdentifier) CloudBlob.generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers, final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols) CloudBlob.generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers, final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols, boolean skipDecoding) CloudBlob.generateUserDelegationSharedAccessSignature(UserDelegationKey delegationKey, SharedAccessBlobPolicy policy) CloudBlob.generateUserDelegationSharedAccessSignature(final UserDelegationKey delegationKey, final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers, final IPRange ipRange, final SharedAccessProtocols protocols) CloudBlob.getContainer() CloudBlob.getCopyState() CloudBlob.getMetadata() CloudBlob.getName() CloudBlob.getParent() CloudBlob.getParentNameFromURI(final StorageUri resourceAddress, final String delimiter, final CloudBlobContainer container) CloudBlob.getProperties() CloudBlob.getQualifiedStorageUri() CloudBlob.getQualifiedUri() CloudBlob.getServiceClient() CloudBlob.getSnapshotID() CloudBlob.getSnapshotQualifiedStorageUri() CloudBlob.getSnapshotQualifiedUri() CloudBlob.getStorageUri() CloudBlob.getStreamMinimumReadSizeInBytes() CloudBlob.getStreamWriteSizeInBytes() CloudBlob.getTransformedAddress(final OperationContext opContext) CloudBlob.getUri() CloudBlob.isSnapshot() CloudBlob.openInputStream() CloudBlob.openInputStream(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.openInputStream(final long offset, final Long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.parent CloudBlob.releaseLease(final AccessCondition accessCondition) CloudBlob.releaseLease(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.renewLease(final AccessCondition accessCondition) CloudBlob.renewLease(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.setContainer(final CloudBlobContainer container) CloudBlob.setMetadata(final HashMap<String, String> metadata) CloudBlob.setProperties(final BlobProperties properties) CloudBlob.setSnapshotID(final String snapshotID) CloudBlob.setStorageUri(final StorageUri storageUri) CloudBlob.setStreamMinimumReadSizeInBytes(final int minimumReadSize) CloudBlob.startCopy(final URI source) CloudBlob.startCopy(final URI source, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.startCopy(final URI source, final String blobTierString, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.startCopy(final URI source, String contentMd5, boolean syncCopy, final String blobTierString, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.startCopy(final URI source, String contentMd5, boolean syncCopy, final String blobTierString, final RehydratePriority rehydratePriority, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.startCopyImpl(final URI source, final String contentMd5, final boolean syncCopy, final boolean incrementalCopy, final String blobTierString, final RehydratePriority rehydratePriority, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, final BlobRequestOptions options) CloudBlob.streamMinimumReadSizeInBytes CloudBlob.streamWriteSizeInBytes CloudBlob.undelete() CloudBlob.undelete(BlobRequestOptions options, OperationContext opContext) CloudBlob.updateEtagAndLastModifiedFromResponse(HttpURLConnection request) CloudBlob.updateLengthFromResponse(HttpURLConnection request) CloudBlob.uploadFromByteArray(final byte[] buffer, final int offset, final int length) CloudBlob.uploadFromByteArray(final byte[] buffer, final int offset, final int length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.uploadFromFile(final String path) CloudBlob.uploadFromFile(final String path, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.uploadMetadata() CloudBlob.uploadMetadata(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.uploadProperties() CloudBlob.uploadProperties(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.validateCPKHeaders(StorageRequest<CloudBlobClient, T, R> request, BlobRequestOptions options, boolean upload)

Constructor Details

CloudBlockBlob

public CloudBlockBlob(final CloudBlockBlob otherBlob)

Creates an instance of the class by copying values from another cloud block blob.

Parameters:

otherBlob - A CloudBlockBlob object that represents the block blob to copy.

CloudBlockBlob

public CloudBlockBlob(final StorageUri blobAbsoluteUri)

Creates an instance of the class using the specified absolute StorageUri.

Parameters:

blobAbsoluteUri - A StorageUri object that represents the absolute URI to the blob.

Throws:

StorageException - If a storage service error occurred.

CloudBlockBlob

public CloudBlockBlob(final StorageUri blobAbsoluteUri, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute StorageUri and credentials.

Parameters:

blobAbsoluteUri - A StorageUri object that represents the absolute StorageUri to the blob.
credentials - A StorageCredentials object used to authenticate access.

Throws:

StorageException - If a storage service error occurred.

CloudBlockBlob

public CloudBlockBlob(final StorageUri blobAbsoluteUri, final String snapshotID, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute StorageUri, snapshot ID, and credentials.

Parameters:

blobAbsoluteUri - A StorageUri object that represents the absolute StorageUri to the blob.
snapshotID - A String that represents the snapshot version, if applicable.
credentials - A StorageCredentials object used to authenticate access.

Throws:

StorageException - If a storage service error occurred.

CloudBlockBlob

public CloudBlockBlob(final URI blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI.

Parameters:

blobAbsoluteUri - A java.net.URI object that represents the absolute URI to the blob.

Throws:

StorageException - If a storage service error occurred.

CloudBlockBlob

public CloudBlockBlob(final URI blobAbsoluteUri, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute URI and credentials.

Parameters:

blobAbsoluteUri - A java.net.URI object that represents the absolute URI to the blob.
credentials - A StorageCredentials object used to authenticate access.

Throws:

StorageException - If a storage service error occurred.

CloudBlockBlob

public CloudBlockBlob(final URI blobAbsoluteUri, final String snapshotID, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute URI, snapshot ID, and credentials.

Parameters:

blobAbsoluteUri - A java.net.URI object that represents the absolute URI to the blob.
snapshotID - A String that represents the snapshot version, if applicable.
credentials - A StorageCredentials object used to authenticate access.

Throws:

StorageException - If a storage service error occurred.

CloudBlockBlob

protected CloudBlockBlob(String blobName, String snapshotID, CloudBlobContainer container)

Creates an instance of the class using the specified type, name, snapshot ID, and container.

Parameters:

blobName - Name of the blob.
snapshotID - A String that represents the snapshot version, if applicable.
container - The reference to the parent container.

Throws:

URISyntaxException - If the resource URI is invalid.

Method Details

commitBlockList

public void commitBlockList(final Iterable blockList)

Commits a block list to the storage service. In order to be written as part of a blob, a block must have been successfully written to the server in a prior uploadBlock operation.

Parameters:

blockList - An enumerable collection of BlockEntry objects that represents the list block items being committed. The size field is ignored.

Throws:

StorageException - If a storage service error occurred.

commitBlockList

public void commitBlockList(final Iterable blockList, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Commits a block list to the storage service using the specified lease ID, request options, and operation context. In order to be written as part of a blob, a block must have been successfully written to the server in a prior uploadBlock operation.

Parameters:

blockList - An enumerable collection of BlockEntry objects that represents the list block items being committed. The size field is ignored.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

StorageException - If a storage service error occurred.

commitBlockList

public void commitBlockList(final Iterable blockList, StandardBlobTier standardBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Commits a block list to the storage service using the specified lease ID, request options, and operation context. In order to be written as part of a blob, a block must have been successfully written to the server in a prior uploadBlock operation.

Parameters:

blockList - An enumerable collection of BlockEntry objects that represents the list block items being committed. The size field is ignored.
standardBlobTier
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

StorageException - If a storage service error occurred.

createBlockFromURI

public void createBlockFromURI(final String blockId, final URI copySource, final Long offset, final Long length)

Creates a block to be committed as part of the block blob, using the specified block ID and the source URL.

Parameters:

blockId - A String that represents the Base-64 encoded block ID. Note for a given blob the length of all Block IDs must be identical.
copySource - The URI of the source data. It can point to any Azure Blob or File that is public or the URL can include a shared access signature.
offset - A long which represents the offset to use as the starting point for the source.
length - A Long which represents the number of bytes to copy or null to copy until the end of the blob.

Throws:

IOException - If an I/O error occurred.
StorageException - If a storage service error occurred.

createBlockFromURI

public void createBlockFromURI(final String blockId, final URI copySource, final Long offset, final Long length, String md5, final AccessCondition sourceAccessCondition, BlobRequestOptions options, OperationContext opContext)

Creates a block to be committed as part of the block blob, using the specified block ID, the specified source URL, the specified lease ID, request options, and operation context.

Parameters:

blockId - A String that represents the Base-64 encoded block ID. Note for a given blob the length of all Block IDs must be identical.
copySource - The URI of the source data. It can point to any Azure Blob or File that is public or the URL can include a shared access signature.
offset - A long which represents the offset to use as the starting point for the source.
length - A Long which represents the number of bytes to copy or null to copy until the end of the blob.
md5 - A String which represents the MD5 caluclated for the range of bytes of the source.
sourceAccessCondition - An AccessCondition object that represents the access conditions for the source blob.
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.

Throws:

StorageException - If a storage service error occurred.

downloadBlockList

public ArrayList downloadBlockList()

Downloads the committed block list from the block blob.

The committed block list includes the list of blocks that have been successfully committed to the block blob. The list of committed blocks is returned in the same order that they were committed to the blob. No block may appear more than once in the committed block list.

Returns:

An ArrayList object of BlockEntry objects that represent the committed list block items downloaded from the block blob.

Throws:

StorageException - If a storage service error occurred.

downloadBlockList

public ArrayList downloadBlockList(final BlockListingFilter blockListingFilter, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Downloads the block list from the block blob using the specified block listing filter, request options, and operation context.

The committed block list includes the list of blocks that have been successfully committed to the block blob. The list of committed blocks is returned in the same order that they were committed to the blob. No block may appear more than once in the committed block list.

Parameters:

blockListingFilter - A BlockListingFilter value that specifies whether to download committed blocks, uncommitted blocks, or all blocks.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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 ArrayList object of BlockEntry objects that represent the list block items downloaded from the block blob.

Throws:

StorageException - If a storage service error occurred.

downloadText

public String downloadText()

Downloads a blob to a string using the platform's default encoding.

Returns:

A String which represents the blob's contents.

Throws:

StorageException - If a storage service error occurred.
IOException

downloadText

public String downloadText(final String charsetName, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Downloads a blob to a string using the specified encoding.

Parameters:

charsetName - A String which represents the name of the charset to use to encode the content. If null, the platform's default encoding is used.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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 String which represents the blob's contents.

Throws:

StorageException - If a storage service error occurred.
IOException

isStreamWriteSizeModified

public boolean isStreamWriteSizeModified()

Gets the flag that indicates whether the default streamWriteSize was modified.

openOutputStream

public BlobOutputStream openOutputStream()

Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, it will be overwritten.

To avoid overwriting and instead throw an error, please use the openOutputStream(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) overload with the appropriate AccessCondition.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

openOutputStream

public BlobOutputStream openOutputStream(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Creates and opens an output stream to write data to the block blob using the specified request options and operation context. If the blob already exists on the service, it will be overwritten.

To avoid overwriting and instead throw an error, please pass in an AccessCondition generated using generateIfNotExistsCondition().

Parameters:

accessCondition - An AccessCondition object that represents the access conditions for the blob.
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 BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

setStreamWriteSizeInBytes

public void setStreamWriteSizeInBytes(final int streamWriteSizeInBytes)

Sets the number of bytes to buffer when writing to a BlobOutputStream.

Parameters:

streamWriteSizeInBytes - An int which represents the maximum block size, in bytes, for writing to a block blob while using a BlobOutputStream object, ranging from 16 KB to 100 MB, inclusive.

Throws:

IllegalArgumentException - If streamWriteSizeInBytes is less than 16 KB or greater than 100 MB.

startCopy

public final String startCopy(final CloudBlockBlob sourceBlob)

Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob.

Parameters:

sourceBlob - A CloudBlockBlob object that represents the source blob to copy.

Returns:

A String which represents the copy ID associated with the copy operation.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

startCopy

public final String startCopy(final CloudBlockBlob sourceBlob, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob, using the specified access conditions, lease ID, request options, and operation context.

Parameters:

sourceBlob - A CloudBlockBlob object that represents the source blob to copy.
sourceAccessCondition - An AccessCondition object that represents the access conditions for the source blob.
destinationAccessCondition - An AccessCondition object that represents the access conditions for the destination blob.
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 String which represents the copy ID associated with the copy operation.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

startCopy

public final String startCopy(final CloudBlockBlob sourceBlob, String contentMd5, boolean syncCopy, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob, using the specified access conditions, lease ID, request options, and operation context.

Parameters:

sourceBlob - A CloudBlockBlob object that represents the source blob to copy.
contentMd5 - An optional hash value used to ensure transactional integrity for the operation. May be null or empty.
syncCopy - A boolean to enable synchronous server copy of blobs.
sourceAccessCondition - An AccessCondition object that represents the access conditions for the source blob.
destinationAccessCondition - An AccessCondition object that represents the access conditions for the destination blob.
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 String which represents the copy ID associated with the copy operation.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

startCopy

public final String startCopy(final CloudBlockBlob sourceBlob, String contentMd5, boolean syncCopy, final StandardBlobTier standardBlobTier, RehydratePriority rehydratePriority, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob, using the blob tier, rehydrate priority, specified access conditions, lease ID, request options, operation context.

Parameters:

sourceBlob - A CloudBlockBlob object that represents the source blob to copy.
contentMd5 - An optional hash value used to ensure transactional integrity for the operation. May be null or empty.
syncCopy - A boolean to enable synchronous server copy of blobs.
standardBlobTier - An StandardBlobTier object that represents the tier of the blob.
rehydratePriority - An RehydratePriority object that represents the rehydrate priority.
sourceAccessCondition - An AccessCondition object that represents the access conditions for the source blob.
destinationAccessCondition - An AccessCondition object that represents the access conditions for the destination blob.
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 String which represents the copy ID associated with the copy operation.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

startCopy

public final String startCopy(final CloudFile sourceFile)

Requests the service to start copying a file's contents, properties, and metadata to a new block blob.

Parameters:

sourceFile - A CloudFile object that represents the source file to copy.

Returns:

A String which represents the copy ID associated with the copy operation.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

startCopy

public final String startCopy(final CloudFile sourceFile, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a file's contents, properties, and metadata to a new block blob, using the specified access conditions, lease ID, request options, and operation context.

Parameters:

sourceFile - A CloudFile object that represents the source file to copy.
sourceAccessCondition - An AccessCondition object that represents the access conditions for the source file.
destinationAccessCondition - An AccessCondition object that represents the access conditions for the destination block blob.
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 String which represents the copy ID associated with the copy operation.

Throws:

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

upload

public void upload(final InputStream sourceStream, final long length)

Uploads the source stream data to the block blob. If the blob already exists on the service, it will be overwritten.

Parameters:

sourceStream - An InputStream object that represents the input stream to write to the block blob.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.

Throws:

IOException - If an I/O error occurred.
StorageException - If a storage service error occurred.

upload

public void upload(final InputStream sourceStream, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads the source stream data to the blob, using the specified lease ID, request options, and operation context. If the blob already exists on the service, it will be overwritten.

Parameters:

sourceStream - An InputStream object that represents the input stream to write to the block blob.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

IOException - If an I/O error occurred.
StorageException - If a storage service error occurred.

upload

public void upload(final InputStream sourceStream, final long length, final StandardBlobTier standardBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads the source stream data to the blob, using the specified lease ID, request options, and operation context. If the blob already exists on the service, it will be overwritten.

Parameters:

sourceStream - An InputStream object that represents the input stream to write to the block blob.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.
standardBlobTier - An String that represents the tier of the blob.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

IOException - If an I/O error occurred.
StorageException - If a storage service error occurred.

uploadBlock

public void uploadBlock(final String blockId, final InputStream sourceStream, final long length)

Uploads a block to be committed as part of the block blob, using the specified block ID.

Parameters:

blockId - A String that represents the Base-64 encoded block ID. Note for a given blob the length of all Block IDs must be identical.
sourceStream - An InputStream object that represents the input stream to write to the block blob.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.

Throws:

IOException - If an I/O error occurred.
StorageException - If a storage service error occurred.

uploadBlock

public void uploadBlock(final String blockId, final InputStream sourceStream, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a block to be committed as part of the block blob, using the specified block ID, the specified lease ID, request options, and operation context.

Parameters:

blockId - A String that represents the Base-64 encoded block ID. Note for a given blob the length of all Block IDs must be identical.
sourceStream - An InputStream object that represents the input stream to write to the block blob.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

IOException - If an I/O error occurred.
StorageException - If a storage service error occurred.

uploadFromByteArray

public void uploadFromByteArray(final byte[] buffer, final int offset, final int length, final StandardBlobTier standardBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a blob from data in a byte array. If the blob already exists on the service, it will be overwritten.

Parameters:

buffer - A byte array which represents the data to write to the blob.
offset - A int which represents the offset of the byte array from which to start the data upload.
length - An int which represents the number of bytes to upload from the input buffer.
standardBlobTier - An StandardBlobTier object that represents the tier of the blob.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

StorageException - If a storage service error occurred.
IOException

uploadFullBlob

protected final void uploadFullBlob(final InputStream sourceStream, final long length, final StandardBlobTier standardBlobTier, final AccessCondition accessCondition, final BlobRequestOptions options, final OperationContext opContext)

Uploads a blob in a single operation.

Parameters:

sourceStream - A InputStream object that represents the source stream to upload.
length - The length, in bytes, of the stream, or -1 if unknown.
standardBlobTier - An StandardBlobTier object that represents the tier of the blob.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

StorageException - If a storage service error occurred.

uploadStandardBlobTier

public void uploadStandardBlobTier(final StandardBlobTier standardBlobTier)

Sets the blob tier on a block blob on a standard storage account.

Parameters:

standardBlobTier - A StandardBlobTier object which represents the tier of the blob.

Throws:

StorageException - If a storage service error occurred.

uploadStandardBlobTier

public void uploadStandardBlobTier(final StandardBlobTier standardBlobTier, BlobRequestOptions options, OperationContext opContext)

Sets the tier on a block blob on a standard storage account.

Parameters:

standardBlobTier - A StandardBlobTier object which represents the tier of the blob.
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 which 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.

Throws:

StorageException - If a storage service error occurred.

uploadStandardBlobTier

public void uploadStandardBlobTier(final StandardBlobTier standardBlobTier, RehydratePriority rehydratePriority, BlobRequestOptions options, OperationContext opContext)

Sets the tier on a block blob on a standard storage account.

Parameters:

standardBlobTier - A StandardBlobTier object which represents the tier of the blob.
rehydratePriority - A RehydratePriority object which represents the rehydrate priority.
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 which 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.

Throws:

StorageException - If a storage service error occurred.

uploadText

public void uploadText(final String content)

Uploads a blob from a string using the platform's default encoding. If the blob already exists on the service, it will be overwritten.

Parameters:

content - A String which represents the content that will be uploaded to the blob.

Throws:

StorageException - If a storage service error occurred.
IOException

uploadText

public void uploadText(final String content, final String charsetName, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a blob from a string using the specified encoding. If the blob already exists on the service, it will be overwritten.

Parameters:

content - A String which represents the content that will be uploaded to the blob.
charsetName - A String which represents the name of the charset to use to encode the content. If null, the platform's default encoding is used.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

StorageException - If a storage service error occurred.
IOException

uploadText

public void uploadText(final String content, final String charsetName, final StandardBlobTier standardBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a blob from a string using the specified encoding. If the blob already exists on the service, it will be overwritten.

Parameters:

content - A String which represents the content that will be uploaded to the blob.
charsetName - A String which represents the name of the charset to use to encode the content. If null, the platform's default encoding is used.
standardBlobTier - An StandardBlobTier object that represents the tier of the blob.
accessCondition - An AccessCondition object that represents the access conditions for the blob.
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.

Throws:

StorageException - If a storage service error occurred.
IOException

Applies to