AZSCloudBlockBlob Class Reference

Inherits from AZSCloudBlob : NSObject
Declared in AZSCloudBlockBlob.h
AZSCloudBlockBlob.m

Overview

The AZSCloudBlockBlob represents a block blob in Azure Storage.

The AZSCloudBlockBlob is used to perform blob-level operations on block blobs, including uploading, retrieving, and deleting.

– initWithUrl:error:

Initializes a newly allocated AZSCloudBlockBlob object

- (instancetype)initWithUrl:(NSURL *)blobAbsoluteUrl error:(NSError **)error

Parameters

blobAbsoluteUrl

The absolute URL to the blob.

error

A pointer to a NSError*, to be set in the event of failure.

Return Value

The newly allocated instance.

Discussion

Initializes a newly allocated AZSCloudBlockBlob object

Declared In

AZSCloudBlockBlob.h

– initWithUrl:credentials:snapshotTime:error:

Initializes a newly allocated AZSCloudBlockBlob object

- (instancetype)initWithUrl:(NSURL *)blobAbsoluteUrl credentials:(AZSStorageCredentials *)credentials snapshotTime:(NSString *)snapshotTime error:(NSError **)error

Parameters

blobAbsoluteUrl

The absolute URL to the blob.

credentials

The AZSStorageCredentials used to authenticate to the blob

snapshotTime

The timestamp of the intended snapshot. If nil, this AZSCloudBlockBlob object refers to the actual blob, not a snapshot.

error

A pointer to a NSError*, to be set in the event of failure.

Return Value

The newly allocated instance.

Discussion

Initializes a newly allocated AZSCloudBlockBlob object

Declared In

AZSCloudBlockBlob.h

– initWithStorageUri:error:

Initializes a newly allocated AZSCloudBlockBlob object

- (instancetype)initWithStorageUri:(AZSStorageUri *)blobAbsoluteUri error:(NSError **)error

Parameters

blobAbsoluteUri

The absolute URL to the blob.

error

A pointer to a NSError*, to be set in the event of failure.

Return Value

The newly allocated instance.

Discussion

Initializes a newly allocated AZSCloudBlockBlob object

Declared In

AZSCloudBlockBlob.h

– initWithStorageUri:credentials:snapshotTime:error:

Initializes a newly allocated AZSCloudBlockBlob object

- (instancetype)initWithStorageUri:(AZSStorageUri *)blobAbsoluteUri credentials:(AZSStorageCredentials *)credentials snapshotTime:(NSString *)snapshotTime error:(NSError **)error

Parameters

blobAbsoluteUri

The absolute URL to the blob.

credentials

The AZSStorageCredentials used to authenticate to the blob

snapshotTime

The timestamp of the intended snapshot. If nil, this AZSCloudBlockBlob object refers to the actual blob, not a snapshot.

error

A pointer to a NSError*, to be set in the event of failure.

Return Value

The newly allocated instance.

Discussion

Initializes a newly allocated AZSCloudBlockBlob object

Declared In

AZSCloudBlockBlob.h

– initWithContainer:name:

Initializes a newly allocated AZSCloudBlockBlob object

- (instancetype)initWithContainer:(AZSCloudBlobContainer *)blobContainer name:(NSString *)blobName

Parameters

blobContainer

The AZSCloudBlobContainer in which the blob exists or should be created.

blobName

The name of the blob.

Return Value

The newly allocated instance.

Discussion

Initializes a newly allocated AZSCloudBlockBlob object

Declared In

AZSCloudBlockBlob.h

– initWithContainer:name:snapshotTime:

Initializes a newly allocated AZSCloudBlockBlob object

- (instancetype)initWithContainer:(AZSCloudBlobContainer *)blobContainer name:(NSString *)blobName snapshotTime:(NSString *)snapshotTime

Parameters

blobContainer

The AZSCloudBlobContainer in which the blob exists or should be created.

blobName

The name of the blob.

snapshotTime

The timestamp of the intended snapshot. If nil, this AZSCloudBlockBlob object refers to the actual blob, not a snapshot.

Return Value

The newly allocated instance.

Discussion

Initializes a newly allocated AZSCloudBlockBlob object

Declared In

AZSCloudBlockBlob.h

– uploadFromStream:completionHandler:

Uploades a blob from given source stream.

- (void)uploadFromStream:(NSInputStream *)sourceStream completionHandler:(void ( ^ ) ( NSError *__AZSNullable ))completionHandler

Parameters

sourceStream

The stream containing the data that the blob should contain.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploades a blob from given source stream.

This operation will schedule the input sourceStream on a runloop (created in a new thread), and read in all data as long as it is able. This will chunk the data into blocks, and upload each of those blocks to the service. Finally, when the stream is finished, it will upload a block list consisting of all read data.

No more than one block’s worth of data will be uploaded at a time. Block size is configurable in the AZSBlobRequestOptions (see – uploadFromStream:accessCondition:requestOptions:operationContext:completionHandler:). Maximum number of outstanding downloads is also configurable in the AZSBlobRequestOptions.

Declared In

AZSCloudBlockBlob.h

– uploadFromStream:accessCondition:requestOptions:operationContext:completionHandler:

Uploades a blob from given source stream.

- (void)uploadFromStream:(NSInputStream *)sourceStream accessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

sourceStream

The stream containing the data that the blob should contain.

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploades a blob from given source stream.

This operation will schedule the input sourceStream on a runloop (created in a new thread), and read in all data as long as it is able. This will chunk the data into blocks, and upload each of those blocks to the service. Finally, when the stream is finished, it will upload a block list consisting of all read data.

No more than one block’s worth of data will be uploaded at a time. Block size is configurable in the AZSBlobRequestOptions. Maximum number of outstanding downloads is also configurable in the AZSBlobRequestOptions.

Declared In

AZSCloudBlockBlob.h

– uploadFromData:completionHandler:

Uploads a blob from given source data.

- (void)uploadFromData:(NSData *)sourceData completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

sourceData

The data that the blob should contain.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a blob from given source data.

UploadFromData uploads all data in the input NSData to the blob on the service. This operation will overwrite any data already in the blob on the service, unless protected with an appropriate AZSAccessCondition.

Declared In

AZSCloudBlockBlob.h

– uploadFromData:accessCondition:requestOptions:operationContext:completionHandler:

Uploads a blob from given source data.

- (void)uploadFromData:(NSData *)sourceData accessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

sourceData

The data that the blob should contain.

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a blob from given source data.

UploadFromData uploads all data in the input NSData to the blob on the service. This operation will overwrite any data already in the blob on the service, unless protected with an appropriate AZSAccessCondition.

Declared In

AZSCloudBlockBlob.h

– uploadFromText:completionHandler:

Uploads a blob from given source text.

- (void)uploadFromText:(NSString *)textToUpload completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

textToUpload

The text that the blob should contain.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a blob from given source text.

UploadFromText encodes the input text as UTF-8 and then uploads it to the blob on the service. This operation will overwrite any data already in the blob on the service, unless protected with an appropriate AZSAccessCondition.

Declared In

AZSCloudBlockBlob.h

– uploadFromText:accessCondition:requestOptions:operationContext:completionHandler:

Uploads a blob from given source text.

- (void)uploadFromText:(NSString *)textToUpload accessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

textToUpload

The text that the blob should contain.

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a blob from given source text.

UploadFromText encodes the input text as UTF-8 and then uploads it to the blob on the service. This operation will overwrite any data already in the blob on the service, unless protected with an appropriate AZSAccessCondition.

Declared In

AZSCloudBlockBlob.h

– uploadFromFileWithPath:completionHandler:

Uploads a blob from given source file.

- (void)uploadFromFileWithPath:(NSString *)filePath completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

filePath

The path to the file containing the data that the blob should contain.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a blob from given source file.

UploadFromText loads an the input file and uploads the contents of that file to the service. Contents will not be read all at once, but instead in a streaming fashion. This operation will overwrite any data already in the blob on the service, unless protected with an appropriate AZSAccessCondition.

Declared In

AZSCloudBlockBlob.h

– uploadFromFileWithPath:accessCondition:requestOptions:operationContext:completionHandler:

Uploads a blob from given source file.

- (void)uploadFromFileWithPath:(NSString *)filePath accessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

filePath

The path to the file containing the data that the blob should contain.

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a blob from given source file.

UploadFromText loads an the input file and uploads the contents of that file to the service. Contents will not be read all at once, but instead in a streaming fashion. This operation will overwrite any data already in the blob on the service, unless protected with an appropriate AZSAccessCondition.

Declared In

AZSCloudBlockBlob.h

– uploadFromFileWithURL:completionHandler:

Uploads a blob from given source file.

- (void)uploadFromFileWithURL:(NSURL *)fileURL completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

fileURL

The URL to the file containing the data that the blob should contain.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a blob from given source file.

UploadFromText loads an the input file and uploads the contents of that file to the service. Contents will not be read all at once, but instead in a streaming fashion. This operation will overwrite any data already in the blob on the service, unless protected with an appropriate AZSAccessCondition.

Declared In

AZSCloudBlockBlob.h

– uploadFromFileWithURL:accessCondition:requestOptions:operationContext:completionHandler:

Uploads a blob from given source file.

- (void)uploadFromFileWithURL:(NSURL *)fileURL accessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

fileURL

The URL to the file containing the data that the blob should contain.

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a blob from given source file.

UploadFromText loads an the input file and uploads the contents of that file to the service. Contents will not be read all at once, but instead in a streaming fashion. This operation will overwrite any data already in the blob on the service, unless protected with an appropriate AZSAccessCondition.

Declared In

AZSCloudBlockBlob.h

– uploadBlockFromData:blockID:completionHandler:

Uploads a single block from given source data.

- (void)uploadBlockFromData:(NSData *)sourceData blockID:(NSString *)blockID completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

sourceData

The data that the blob should contain.

blockID

The base64-encoded string identifying the block.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a single block from given source data.

This operation uploads one block of data to the blob in the Storage Service. The block will remain uncommitted (meaning the data will not be considered part of the blob) until a corresponding uploadBlockList call.

Note that all blocks in a given blob must have the same length Block ID.

Declared In

AZSCloudBlockBlob.h

– uploadBlockFromData:blockID:contentMD5:accessCondition:requestOptions:operationContext:completionHandler:

Uploads a single block from given source data.

- (void)uploadBlockFromData:(NSData *)sourceData blockID:(NSString *)blockID contentMD5:(NSString *)contentMD5 accessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

sourceData

The data that the blob should contain.

blockID

The base64-encoded string identifying the block.

contentMD5

Optional. The content-MD5 to use for transactional integrety for the uploadBlock request. If contentMD5 is nil, and requestOptions.useTransactionalMD5 is set to YES, the library will calculate the MD5 of the block for you. This value is not stored on the service.

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a single block from given source data.

This operation uploads one block of data to the blob in the Storage Service. The block will remain uncommitted (meaning the data will not be considered part of the blob) until a corresponding uploadBlockList call.

Note that all blocks in a given blob must have the same length Block ID.

Declared In

AZSCloudBlockBlob.h

– uploadBlockListFromArray:completionHandler:

Uploads a block list, committing the blocks in the list to the blob.

- (void)uploadBlockListFromArray:(NSArray *)blockList completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

blockList

The blocks that the blob should contain. Each item in this array must be an instance of the AZSBlockListItem class.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a block list, committing the blocks in the list to the blob.

This operation commits a block list to the blob, which causes the blob to be committed. The blocks included in the list will be the data in the blob, in order.

Declared In

AZSCloudBlockBlob.h

– uploadBlockListFromArray:accessCondition:requestOptions:operationContext:completionHandler:

Uploads a block list, committing the blocks in the list to the blob.

- (void)uploadBlockListFromArray:(NSArray *)blockList accessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext completionHandler:(void ( ^ ) ( NSError *))completionHandler

Parameters

blockList

The blocks that the blob should contain. Each item in this array must be an instance of the AZSBlockListItem class.

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

completionHandler

The block of code to execute when the upload call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.

Discussion

Uploads a block list, committing the blocks in the list to the blob.

This operation commits a block list to the blob, which causes the blob to be committed. The blocks included in the list will be the data in the blob, in order.

Declared In

AZSCloudBlockBlob.h

– downloadBlockListFromFilter:completionHandler:

Downloads the block list for a blob.

- (void)downloadBlockListFromFilter:(AZSBlockListFilter)blockListFilter completionHandler:(void ( ^ ) ( NSError *, NSArray *))completionHandler

Parameters

blockListFilter

Whether we want to fetch only uncommitted blocks, only committed blocks, or all blocks.

completionHandler

The block of code to execute when the download call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.
NSArray * The list of blocks in the blob. Each item in the array will be an instance of AZSBlockListItem.

Discussion

Downloads the block list for a blob.

This operation fetches the current block list from the service.

Note that this data is not streamed, all data is in memory at once. This may use a significant amount of memory for blobs with many blocks.

Declared In

AZSCloudBlockBlob.h

– downloadBlockListFromFilter:accessCondition:requestOptions:operationContext:completionHandler:

Downloads the block list for a blob.

- (void)downloadBlockListFromFilter:(AZSBlockListFilter)blockListFilter accessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext completionHandler:(void ( ^ ) ( NSError *, NSArray *))completionHandler

Parameters

blockListFilter

Whether we want to fetch only uncommitted blocks, only committed blocks, or all blocks.

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

completionHandler

The block of code to execute when the download call completes.

Parameter name Description
NSError * Nil if the operation succeeded without error, error with details about the failure otherwise.
NSArray * The list of blocks in the blob. Each item in the array will be an instance of AZSBlockListItem.

Discussion

Downloads the block list for a blob.

This operation fetches the current block list from the service.

Note that this data is not streamed, all data is in memory at once. This may use a significant amount of memory for blobs with many blocks.

Declared In

AZSCloudBlockBlob.h

– createOutputStream

Creates an output stream that is capable of writing to the blob.

- (AZSBlobOutputStream *)createOutputStream

Return Value

The created AZSBlobOutputStream, capable of writing to this blob.

Discussion

Creates an output stream that is capable of writing to the blob.

This method returns an instance of AZSBlobOutputStream. The caller can then assign a delegate and schedule the stream in a runloop (similar to any other NSOutputStream.) See AZSBlobOutputStream documentation for details.

Declared In

AZSCloudBlockBlob.h

– createOutputStreamWithAccessCondition:requestOptions:operationContext:

Creates an output stream that is capable of writing to the blob.

- (AZSBlobOutputStream *)createOutputStreamWithAccessCondition:(AZSAccessCondition *)accessCondition requestOptions:(AZSBlobRequestOptions *)requestOptions operationContext:(AZSOperationContext *)operationContext

Parameters

accessCondition

The access condition for the request.

requestOptions

The options to use for the request.

operationContext

The operation context to use for the call.

Return Value

The created AZSBlobOutputStream, capable of writing to this blob.

Discussion

Creates an output stream that is capable of writing to the blob.

This method returns an instance of AZSBlobOutputStream. The caller can then assign a delegate and schedule the stream in a runloop (similar to any other NSOutputStream.) See AZSBlobOutputStream documentation for details.

Declared In

AZSCloudBlockBlob.h