CloudPageBlob Class

public class CloudPageBlob extends CloudBlob

Represents a Microsoft Azure page blob.

Constructor Summary

Constructor Description
CloudPageBlob(final CloudPageBlob otherBlob)

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

CloudPageBlob(final StorageUri blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI and storage service client.

CloudPageBlob(final StorageUri blobAbsoluteUri, final StorageCredentials credentials)

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

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

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

CloudPageBlob(final URI blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI and storage service client.

CloudPageBlob(final URI blobAbsoluteUri, final StorageCredentials credentials)

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

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

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

CloudPageBlob(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 clearPages(final long offset, final long length)

Clears pages from a page blob.

Calling releases the storage space used by the specified pages. Pages that have been cleared are no longer tracked as part of the page blob, and no longer incur a charge against the storage account.

void clearPages(final long offset, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Clears pages from a page blob using the specified lease ID, request options, and operation context.

Calling releases the storage space used by the specified pages. Pages that have been cleared are no longer tracked as part of the page blob, and no longer incur a charge against the storage account.

void create(final long length)

Creates a page blob. If the blob already exists, this will replace it. To instead throw an error if the blob already exists, use the create(final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) overload with generateIfNotExistsCondition().

void create(final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Creates a page blob using the specified request options and operation context. If the blob already exists, this will replace it. To instead throw an error if the blob already exists, use generateIfNotExistsCondition().

void create(final long length, final PremiumPageBlobTier premiumBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Creates a page blob using the specified request options and operation context. If the blob already exists, this will replace it. To instead throw an error if the blob already exists, use generateIfNotExistsCondition().

ArrayList<PageRange> downloadPageRanges()

Returns a collection of page ranges and their starting and ending byte offsets.

The start and end byte offsets for each page range are inclusive.

ArrayList<PageRange> downloadPageRanges(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Returns a collection of page ranges and their starting and ending byte offsets using the specified request options and operation context.

List<PageRange> downloadPageRanges(final long offset, final Long length)

Returns a collection of page ranges and their starting and ending byte offsets.

List<PageRange> downloadPageRanges(final long offset, final Long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Returns a collection of page ranges and their starting and ending byte offsets using the specified request options and operation context.

List<PageRangeDiff> downloadPageRangesDiff(final String previousSnapshot)

Gets the collection of page ranges that differ between a specified snapshot and this object.

List<PageRangeDiff> downloadPageRangesDiff(final String previousSnapshot, final Long offset, final Long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Gets the collection of page ranges that differ between a specified snapshot and this object.

BlobOutputStream openWriteExisting()

Opens an output stream object to write data to the page blob. The page blob must already exist and any existing data may be overwritten.

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

Opens an output stream object to write data to the page blob, using the specified lease ID, request options and operation context. The page blob must already exist and any existing data may be overwritten.

BlobOutputStream openWriteNew(final long length)

Opens an output stream object to write data to the page blob. The page blob does not need to yet exist and will be created with the length specified. If the blob already exists on the service, it will be overwritten.

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

BlobOutputStream openWriteNew(final long length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Opens an output stream object to write data to the page blob, using the specified lease ID, request options and operation context. The page blob does not need to yet exist and will be created with the length specified.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().

BlobOutputStream openWriteNew(final long length, final PremiumPageBlobTier premiumBlobTier, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Opens an output stream object to write data to the page blob, using the specified lease ID, request options and operation context. The page blob does not need to yet exist and will be created with the length specified.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 putPagesFromURI(long offset, long length, final URI copySource, final Long sourceOffset)

Writes a PageRange, using the specified source URL.

void putPagesFromURI(long offset, long length, final URI copySource, final Long sourceOffset, String md5, AccessCondition accessCondition, AccessCondition sourceAccessCondition, BlobRequestOptions options, OperationContext opContext)

Writes a PageRange, using the specified source URL.

void resize(long size)

Resizes the page blob to the specified size.

void resize(long size, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Resizes the page blob to the specified size.

void setStreamWriteSizeInBytes(final int streamWriteSizeInBytes)

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

final String startCopy(final CloudPageBlob sourceBlob)

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

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

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

final String startCopy(final CloudPageBlob sourceBlob, final PremiumPageBlobTier premiumBlobTier, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

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

final String startIncrementalCopy(final CloudPageBlob sourceSnapshot)

Requests the service to start an incremental copy of another page blob's contents, properties, and metadata to this blob.

final String startIncrementalCopy(final CloudPageBlob sourceSnapshot, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

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

final String startIncrementalCopy(final URI sourceSnapshot)

Requests the service to start an incremental copy of another page blob's contents, properties, and metadata to this blob.

final String startIncrementalCopy(final URI sourceSnapshot, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

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

void updateSequenceNumberFromResponse(HttpURLConnection request)
void upload(final InputStream sourceStream, final long length)

Uploads the source stream data to the page 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 page 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 PremiumPageBlobTier premiumBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

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

void uploadFromByteArray(final byte[] buffer, final int offset, final int length, final PremiumPageBlobTier premiumBlobTier, 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.

void uploadFromFile(final String path, final PremiumPageBlobTier premiumBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a blob from a file. If the blob already exists on the service, it will be overwritten.

void uploadPages(final InputStream sourceStream, final long offset, final long length)

Uploads a range of contiguous pages, up to 4 MB in size, at the specified offset in the page blob.

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

Uploads a range of contiguous pages, up to 4 MB in size, at the specified offset in the page blob, using the specified lease ID, request options, and operation context.

void uploadPremiumPageBlobTier(final PremiumPageBlobTier premiumBlobTier)

Sets the blob tier on a page blob on a premium storage account.

void uploadPremiumPageBlobTier(final PremiumPageBlobTier premiumBlobTier, BlobRequestOptions options, OperationContext opContext)

Sets the tier on a page blob on a premium storage account.

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

CloudPageBlob

public CloudPageBlob(final CloudPageBlob otherBlob)

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

Parameters:

otherBlob - A CloudPageBlob object which represents the page blob to copy.

CloudPageBlob

public CloudPageBlob(final StorageUri blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI and storage service client.

Parameters:

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

Throws:

StorageException - If a storage service error occurred.

CloudPageBlob

public CloudPageBlob(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 URI to the blob.
credentials - A StorageCredentials object used to authenticate access.

Throws:

StorageException - If a storage service error occurred.

CloudPageBlob

public CloudPageBlob(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 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.

CloudPageBlob

public CloudPageBlob(final URI blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI and storage service client.

Parameters:

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

Throws:

StorageException - If a storage service error occurred.

CloudPageBlob

public CloudPageBlob(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.

CloudPageBlob

public CloudPageBlob(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.

CloudPageBlob

protected CloudPageBlob(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

clearPages

public void clearPages(final long offset, final long length)

Clears pages from a page blob.

Calling releases the storage space used by the specified pages. Pages that have been cleared are no longer tracked as part of the page blob, and no longer incur a charge against the storage account.

Parameters:

offset - The offset, in bytes, at which to begin clearing pages. This value must be a multiple of 512.
length - The length, in bytes, of the data range to be cleared. This value must be a multiple of 512.

Throws:

StorageException - If a storage service error occurred.

clearPages

public void clearPages(final long offset, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Clears pages from a page blob using the specified lease ID, request options, and operation context.

Calling releases the storage space used by the specified pages. Pages that have been cleared are no longer tracked as part of the page blob, and no longer incur a charge against the storage account.

Parameters:

offset - A long which represents the offset, in bytes, at which to begin clearing pages. This value must be a multiple of 512.
length - A long which represents the length, in bytes, of the data range to be cleared. This value must be a multiple of 512.
accessCondition - An AccessCondition object which 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 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.

create

public void create(final long length)

Creates a page blob. If the blob already exists, this will replace it. To instead throw an error if the blob already exists, use the create(final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) overload with generateIfNotExistsCondition().

Parameters:

length - A long which represents the size, in bytes, of the page blob.

Throws:

IllegalArgumentException - If the length is not a multiple of 512.
StorageException - If a storage service error occurred.

create

public void create(final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Creates a page blob using the specified request options and operation context. If the blob already exists, this will replace it. To instead throw an error if the blob already exists, use generateIfNotExistsCondition().

Parameters:

length - A long which represents the size, in bytes, of the page blob.
accessCondition - An AccessCondition object which 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 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:

IllegalArgumentException - If the length is not a multiple of 512.
StorageException - If a storage service error occurred.

create

public void create(final long length, final PremiumPageBlobTier premiumBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Creates a page blob using the specified request options and operation context. If the blob already exists, this will replace it. To instead throw an error if the blob already exists, use generateIfNotExistsCondition().

Parameters:

length - A long which represents the size, in bytes, of the page blob.
premiumBlobTier - A PremiumPageBlobTier object which represents the tier of the blob.
accessCondition - An AccessCondition object which 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 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:

IllegalArgumentException - If the length is not a multiple of 512.
StorageException - If a storage service error occurred.

downloadPageRanges

public ArrayList downloadPageRanges()

Returns a collection of page ranges and their starting and ending byte offsets.

The start and end byte offsets for each page range are inclusive.

Returns:

An ArrayList object which represents the set of page ranges and their starting and ending byte offsets.

Throws:

StorageException - If a storage service error occurred.

downloadPageRanges

public ArrayList downloadPageRanges(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Returns a collection of page ranges and their starting and ending byte offsets using the specified request options and operation context.

Parameters:

accessCondition - An AccessCondition object which 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 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.

Returns:

An ArrayList object which represents the set of page ranges and their starting and ending byte offsets.

Throws:

StorageException - If a storage service error occurred.

downloadPageRanges

public List downloadPageRanges(final long offset, final Long length)

Returns a collection of page ranges and their starting and ending byte offsets.

Parameters:

offset - The starting offset of the data range over which to list page ranges, in bytes. Must be a multiple of 512.
length - The length of the data range over which to list page ranges, in bytes. Must be a multiple of 512.

Returns:

A List object which represents the set of page ranges and their starting and ending byte offsets.

Throws:

StorageException - If a storage service error occurred.

downloadPageRanges

public List downloadPageRanges(final long offset, final Long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Returns a collection of page ranges and their starting and ending byte offsets using the specified request options and operation context.

Parameters:

offset - The starting offset of the data range over which to list page ranges, in bytes. Must be a multiple of 512.
length - The length of the data range over which to list page ranges, in bytes. Must be a multiple of 512.
accessCondition - An AccessCondition object which 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 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.

Returns:

A List object which represents the set of page ranges and their starting and ending byte offsets.

Throws:

StorageException - If a storage service error occurred.

downloadPageRangesDiff

public List downloadPageRangesDiff(final String previousSnapshot)

Gets the collection of page ranges that differ between a specified snapshot and this object.

Parameters:

previousSnapshot - A string representing the snapshot to use as the starting point for the diff. If this CloudPageBlob represents a snapshot, the previousSnapshot parameter must be prior to the current snapshot.

Returns:

A List object containing the set of differing page ranges.

Throws:

StorageException - If a storage service error occurred.

downloadPageRangesDiff

public List downloadPageRangesDiff(final String previousSnapshot, final Long offset, final Long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Gets the collection of page ranges that differ between a specified snapshot and this object.

Parameters:

previousSnapshot - A string representing the snapshot timestamp to use as the starting point for the diff. If this CloudPageBlob represents a snapshot, the previousSnapshot parameter must be prior to the current snapshot.
offset - The starting offset of the data range over which to list page ranges, in bytes. Must be a multiple of 512.
length - The length of the data range over which to list page ranges, in bytes. Must be a multiple of 512.
accessCondition - An AccessCondition object which 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 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.

Returns:

A List object containing the set of differing page ranges.

Throws:

StorageException - If a storage service error occurred.

openWriteExisting

public BlobOutputStream openWriteExisting()

Opens an output stream object to write data to the page blob. The page blob must already exist and any existing data may be overwritten.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

openWriteExisting

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

Opens an output stream object to write data to the page blob, using the specified lease ID, request options and operation context. The page blob must already exist and any existing data may be overwritten.

Parameters:

accessCondition - An AccessCondition object which 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 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.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

openWriteNew

public BlobOutputStream openWriteNew(final long length)

Opens an output stream object to write data to the page blob. The page blob does not need to yet exist and will be created with the length specified. If the blob already exists on the service, it will be overwritten.

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

Parameters:

length - A long which represents the length, in bytes, of the stream to create. This value must be a multiple of 512.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

openWriteNew

public BlobOutputStream openWriteNew(final long length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Opens an output stream object to write data to the page blob, using the specified lease ID, request options and operation context. The page blob does not need to yet exist and will be created with the length specified.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:

length - A long which represents the length, in bytes, of the stream to create. This value must be a multiple of 512.
accessCondition - An AccessCondition object which 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 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.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

openWriteNew

public BlobOutputStream openWriteNew(final long length, final PremiumPageBlobTier premiumBlobTier, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Opens an output stream object to write data to the page blob, using the specified lease ID, request options and operation context. The page blob does not need to yet exist and will be created with the length specified.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:

length - A long which represents the length, in bytes, of the stream to create. This value must be a multiple of 512.
premiumBlobTier - A PremiumPageBlobTier object which represents the tier of the blob.
accessCondition - An AccessCondition object which 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 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.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

putPagesFromURI

public void putPagesFromURI(long offset, long length, final URI copySource, final Long sourceOffset)

Writes a PageRange, using the specified source URL.

Parameters:

offset - The offset, in bytes, at which to begin writing pages. This value must be a multiple of 512.
length - The length, in bytes, of the data range to be written. This value must be a multiple of 512. This value will also be used as the length of data to copy from the source.
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.
sourceOffset - A long which represents the offset to use as the starting point for the source. The length of data to copy from the source will be taken from the source length parameter.

Throws:

StorageException - If a storage service error occurred.

putPagesFromURI

public void putPagesFromURI(long offset, long length, final URI copySource, final Long sourceOffset, String md5, AccessCondition accessCondition, AccessCondition sourceAccessCondition, BlobRequestOptions options, OperationContext opContext)

Writes a PageRange, using the specified source URL.

Parameters:

offset - The offset, in bytes, at which to begin writing pages. This value must be a multiple of 512.
length - The length, in bytes, of the data range to be written. This value must be a multiple of 512. This value will also be used as the length of data to copy from the source.
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.
sourceOffset - A long which represents the offset to use as the starting point for the source. The length of data to copy from the source will be taken from the source length parameter.
md5 - A String which represents the MD5 hash for the data.
accessCondition - An AccessCondition object which represents the access conditions for the blob.
sourceAccessCondition - An AccessCondition object which 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 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.

resize

public void resize(long size)

Resizes the page blob to the specified size.

Parameters:

size - A long which represents the size of the page blob, in bytes.

Throws:

StorageException - If a storage service error occurred.

resize

public void resize(long size, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Resizes the page blob to the specified size.

Parameters:

size - A long which represents the size of the page blob, in bytes.
accessCondition - An AccessCondition object which 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 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.

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 number of bytes to buffer when writing to a page blob stream. This value must be a multiple of 512 and less than or equal to 4 MB.

Throws:

IllegalArgumentException - If streamWriteSizeInBytes is less than 512, greater than 4 MB, or not a multiple or 512.

startCopy

public final String startCopy(final CloudPageBlob sourceBlob)

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

Parameters:

sourceBlob - A CloudPageBlob 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 CloudPageBlob sourceBlob, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

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

Parameters:

sourceBlob - A CloudPageBlob 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 CloudPageBlob sourceBlob, final PremiumPageBlobTier premiumBlobTier, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

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

Parameters:

sourceBlob - A CloudPageBlob object that represents the source blob to copy.
premiumBlobTier - A PremiumPageBlobTier object which represents the tier of the blob.
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

startIncrementalCopy

public final String startIncrementalCopy(final CloudPageBlob sourceSnapshot)

Requests the service to start an incremental copy of another page blob's contents, properties, and metadata to this blob.

Parameters:

sourceSnapshot - A CloudPageBlob object that represents the source blob to copy. Must be a snapshot.

Returns:

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

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

startIncrementalCopy

public final String startIncrementalCopy(final CloudPageBlob sourceSnapshot, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

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

Parameters:

sourceSnapshot - A CloudPageBlob object that represents the source blob to copy. Must be a snapshot.
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

startIncrementalCopy

public final String startIncrementalCopy(final URI sourceSnapshot)

Requests the service to start an incremental copy of another page blob's contents, properties, and metadata to this blob.

Parameters:

sourceSnapshot - A CloudPageBlob object that represents the source blob to copy. Must be a snapshot.

Returns:

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

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

startIncrementalCopy

public final String startIncrementalCopy(final URI sourceSnapshot, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

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

Parameters:

sourceSnapshot - A CloudPageBlob object that represents the source blob to copy. Must be a snapshot.
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

updateSequenceNumberFromResponse

protected void updateSequenceNumberFromResponse(HttpURLConnection request)

Parameters:

request

upload

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

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

Parameters:

sourceStream - An InputStream object to read from.
length - A long which represents the length, in bytes, of the stream data, must be non zero and a multiple of 512.

Throws:

IOException - If an I/O exception 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 page 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 to read from.
length - A long which represents the length, in bytes, of the stream data. This must be great than zero and a multiple of 512.
accessCondition - An AccessCondition object which 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 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:

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

upload

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

Uploads the source stream data to the page 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 to read from.
length - A long which represents the length, in bytes, of the stream data. This must be great than zero and a multiple of 512.
premiumBlobTier - A PremiumPageBlobTier object which represents the tier of the blob.
accessCondition - An AccessCondition object which 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 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:

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

uploadFromByteArray

public void uploadFromByteArray(final byte[] buffer, final int offset, final int length, final PremiumPageBlobTier premiumBlobTier, 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.
premiumBlobTier - A PremiumPageBlobTier object which 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

uploadFromFile

public void uploadFromFile(final String path, final PremiumPageBlobTier premiumBlobTier, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads a blob from a file. If the blob already exists on the service, it will be overwritten.

Parameters:

path - A String which represents the path to the file to be uploaded.
premiumBlobTier - A PremiumPageBlobTier object which 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

uploadPages

public void uploadPages(final InputStream sourceStream, final long offset, final long length)

Uploads a range of contiguous pages, up to 4 MB in size, at the specified offset in the page blob.

Parameters:

sourceStream - An InputStream object which represents the input stream to write to the page blob.
offset - A long which represents the offset, in number of bytes, at which to begin writing the data. This value must be a multiple of 512.
length - A long which represents the length, in bytes, of the data to write. This value must be a multiple of 512.

Throws:

IllegalArgumentException - If the offset or length are not multiples of 512, or if the length is greater than 4 MB.
IOException - If an I/O exception occurred.
StorageException - If a storage service error occurred.

uploadPages

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

Uploads a range of contiguous pages, up to 4 MB in size, at the specified offset in the page blob, using the specified lease ID, request options, and operation context.

Parameters:

sourceStream - An InputStream object which represents the input stream to write to the page blob.
offset - A long which represents the offset, in number of bytes, at which to begin writing the data. This value must be a multiple of 512.
length - A long which represents the length, in bytes, of the data to write. This value must be a multiple of 512.
accessCondition - An AccessCondition object which 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 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:

IllegalArgumentException - If the offset or length are not multiples of 512, or if the length is greater than 4 MB.
IOException - If an I/O exception occurred.
StorageException - If a storage service error occurred.

uploadPremiumPageBlobTier

public void uploadPremiumPageBlobTier(final PremiumPageBlobTier premiumBlobTier)

Sets the blob tier on a page blob on a premium storage account.

Parameters:

premiumBlobTier - A PremiumPageBlobTier object which represents the tier of the blob.

Throws:

StorageException - If a storage service error occurred.

uploadPremiumPageBlobTier

public void uploadPremiumPageBlobTier(final PremiumPageBlobTier premiumBlobTier, BlobRequestOptions options, OperationContext opContext)

Sets the tier on a page blob on a premium storage account.

Parameters:

premiumBlobTier - A PremiumPageBlobTier 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.

Applies to