Class PageBlobClient
SpecializedBlobClientBuilder
or via the method
BlobClient.getPageBlobClient()
. This class does not hold any state about a particular blob, but is instead a
convenient way of sending appropriate requests to the resource on the service.
Please refer to the Azure Docs for more information.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Indicates the maximum number of bytes that may be sent in a call to putPage.static final int
Indicates the number of bytes in a page. -
Method Summary
Modifier and TypeMethodDescriptionclearPages
(PageRange pageRange) Frees the specified pages from the page blob.com.azure.core.http.rest.Response<PageBlobItem>
clearPagesWithResponse
(PageRange pageRange, PageBlobRequestConditions pageBlobRequestConditions, Duration timeout, com.azure.core.util.Context context) Frees the specified pages from the page blob.copyIncremental
(String source, String snapshot) Begins an operation to start an incremental copy from one page blob's snapshot to this page blob.com.azure.core.http.rest.Response<CopyStatusType>
copyIncrementalWithResponse
(PageBlobCopyIncrementalOptions options, Duration timeout, com.azure.core.util.Context context) Begins an operation to start an incremental copy from one page blob's snapshot to this page blob.com.azure.core.http.rest.Response<CopyStatusType>
copyIncrementalWithResponse
(String source, String snapshot, com.azure.core.http.RequestConditions modifiedRequestConditions, Duration timeout, com.azure.core.util.Context context) Begins an operation to start an incremental copy from one page blob's snapshot to this page blob.create
(long size) Creates a page blob of the specified length.create
(long size, boolean overwrite) Creates a page blob of the specified length.createIfNotExists
(long size) Creates a page blob of the specified length if it does not exist.com.azure.core.http.rest.Response<PageBlobItem>
createIfNotExistsWithResponse
(PageBlobCreateOptions options, Duration timeout, com.azure.core.util.Context context) Creates a page blob of the specified length if it does not exist.com.azure.core.http.rest.Response<PageBlobItem>
createWithResponse
(long size, Long sequenceNumber, BlobHttpHeaders headers, Map<String, String> metadata, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Creates a page blob of the specified length.com.azure.core.http.rest.Response<PageBlobItem>
createWithResponse
(PageBlobCreateOptions options, Duration timeout, com.azure.core.util.Context context) Creates a page blob of the specified length.getBlobOutputStream
(PageRange pageRange) Creates and opens an output stream to write data to the page blob.getBlobOutputStream
(PageRange pageRange, BlobRequestConditions requestConditions) Creates and opens an output stream to write data to the page blob.getCustomerProvidedKeyClient
(CustomerProvidedKey customerProvidedKey) Creates a newPageBlobClient
with the specifiedcustomerProvidedKey
.getEncryptionScopeClient
(String encryptionScope) Creates a newPageBlobClient
with the specifiedencryptionScope
.getManagedDiskPageRangesDiff
(BlobRange blobRange, String prevSnapshotUrl) This API only works for managed disk accounts.com.azure.core.http.rest.Response<PageList>
getManagedDiskPageRangesDiffWithResponse
(BlobRange blobRange, String prevSnapshotUrl, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) This API only works for managed disk accounts.getPageRanges
(BlobRange blobRange) Deprecated.getPageRangesDiff
(BlobRange blobRange, String prevSnapshot) Deprecated.com.azure.core.http.rest.Response<PageList>
getPageRangesDiffWithResponse
(BlobRange blobRange, String prevSnapshot, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Deprecated.com.azure.core.http.rest.Response<PageList>
getPageRangesWithResponse
(BlobRange blobRange, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Deprecated.com.azure.core.http.rest.PagedIterable<PageRangeItem>
listPageRanges
(BlobRange blobRange) Returns the list of valid page ranges for a page blob or snapshot of a page blob.com.azure.core.http.rest.PagedIterable<PageRangeItem>
listPageRanges
(ListPageRangesOptions options, Duration timeout, com.azure.core.util.Context context) Returns the list of valid page ranges for a page blob or snapshot of a page blob.com.azure.core.http.rest.PagedIterable<PageRangeItem>
listPageRangesDiff
(BlobRange blobRange, String prevSnapshot) Gets the collection of page ranges that differ between a specified snapshot and this page blob.com.azure.core.http.rest.PagedIterable<PageRangeItem>
listPageRangesDiff
(ListPageRangesDiffOptions options, Duration timeout, com.azure.core.util.Context context) Gets the collection of page ranges that differ between a specified snapshot and this page blob.resize
(long size) Resizes the page blob to the specified size (which must be a multiple of 512).com.azure.core.http.rest.Response<PageBlobItem>
resizeWithResponse
(long size, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Resizes the page blob to the specified size (which must be a multiple of 512).updateSequenceNumber
(SequenceNumberActionType action, Long sequenceNumber) Sets the page blob's sequence number.com.azure.core.http.rest.Response<PageBlobItem>
updateSequenceNumberWithResponse
(SequenceNumberActionType action, Long sequenceNumber, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Sets the page blob's sequence number.uploadPages
(PageRange pageRange, InputStream body) Writes one or more pages to the page blob.uploadPagesFromUrl
(PageRange range, String sourceUrl, Long sourceOffset) Writes one or more pages from the source page blob to this page blob.com.azure.core.http.rest.Response<PageBlobItem>
uploadPagesFromUrlWithResponse
(PageRange range, String sourceUrl, Long sourceOffset, byte[] sourceContentMd5, PageBlobRequestConditions destRequestConditions, BlobRequestConditions sourceRequestConditions, Duration timeout, com.azure.core.util.Context context) Writes one or more pages from the source page blob to this page blob.com.azure.core.http.rest.Response<PageBlobItem>
uploadPagesFromUrlWithResponse
(PageBlobUploadPagesFromUrlOptions options, Duration timeout, com.azure.core.util.Context context) Writes one or more pages from the source page blob to this page blob.com.azure.core.http.rest.Response<PageBlobItem>
uploadPagesWithResponse
(PageRange pageRange, InputStream body, byte[] contentMd5, PageBlobRequestConditions pageBlobRequestConditions, Duration timeout, com.azure.core.util.Context context) Writes one or more pages to the page blob.Methods inherited from class com.azure.storage.blob.specialized.BlobClientBase
abortCopyFromUrl, abortCopyFromUrlWithResponse, beginCopy, beginCopy, beginCopy, copyFromUrl, copyFromUrlWithResponse, copyFromUrlWithResponse, createSnapshot, createSnapshotWithResponse, delete, deleteIfExists, deleteIfExistsWithResponse, deleteImmutabilityPolicy, deleteImmutabilityPolicyWithResponse, deleteWithResponse, download, downloadContent, downloadContentWithResponse, downloadStream, downloadStreamWithResponse, downloadToFile, downloadToFile, downloadToFileWithResponse, downloadToFileWithResponse, downloadToFileWithResponse, downloadWithResponse, exists, existsWithResponse, generateSas, generateSas, generateUserDelegationSas, generateUserDelegationSas, getAccountInfo, getAccountInfoWithResponse, getAccountName, getAccountUrl, getBlobName, getBlobUrl, getContainerClient, getContainerName, getCustomerProvidedKey, getHttpPipeline, getProperties, getPropertiesWithResponse, getServiceVersion, getSnapshotClient, getSnapshotId, getTags, getTagsWithResponse, getVersionClient, getVersionId, isSnapshot, openInputStream, openInputStream, openInputStream, openInputStream, openQueryInputStream, openQueryInputStreamWithResponse, query, queryWithResponse, setAccessTier, setAccessTierWithResponse, setAccessTierWithResponse, setHttpHeaders, setHttpHeadersWithResponse, setImmutabilityPolicy, setImmutabilityPolicyWithResponse, setLegalHold, setLegalHoldWithResponse, setMetadata, setMetadataWithResponse, setTags, setTagsWithResponse, undelete, undeleteWithResponse
-
Field Details
-
PAGE_BYTES
public static final int PAGE_BYTESIndicates the number of bytes in a page.- See Also:
-
MAX_PUT_PAGES_BYTES
public static final int MAX_PUT_PAGES_BYTESIndicates the maximum number of bytes that may be sent in a call to putPage.- See Also:
-
-
Method Details
-
getEncryptionScopeClient
Creates a newPageBlobClient
with the specifiedencryptionScope
.- Overrides:
getEncryptionScopeClient
in classBlobClientBase
- Parameters:
encryptionScope
- the encryption scope for the blob, passnull
to use no encryption scope.- Returns:
- a
PageBlobClient
with the specifiedencryptionScope
.
-
getCustomerProvidedKeyClient
Creates a newPageBlobClient
with the specifiedcustomerProvidedKey
.- Overrides:
getCustomerProvidedKeyClient
in classBlobClientBase
- Parameters:
customerProvidedKey
- theCustomerProvidedKey
for the blob, passnull
to use no customer provided key.- Returns:
- a
PageBlobClient
with the specifiedcustomerProvidedKey
.
-
getBlobOutputStream
Creates and opens an output stream to write data to the page blob. If the blob already exists on the service, it will be overwritten.- Parameters:
pageRange
- APageRange
object. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are 0-511, 512-1023, etc.- Returns:
- A
BlobOutputStream
object used to write data to the blob. - Throws:
BlobStorageException
- If a storage service error occurred.
-
getBlobOutputStream
public BlobOutputStream getBlobOutputStream(PageRange pageRange, BlobRequestConditions requestConditions) Creates and opens an output stream to write data to the page blob. If the blob already exists on the service, it will be overwritten.- Parameters:
pageRange
- APageRange
object. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are 0-511, 512-1023, etc.requestConditions
- ABlobRequestConditions
object that represents the access conditions for the blob.- Returns:
- A
BlobOutputStream
object used to write data to the blob. - Throws:
BlobStorageException
- If a storage service error occurred.
-
create
Creates a page blob of the specified length. By default this method will not overwrite an existing blob. Call PutPage to upload data data to a page blob. For more information, see the Azure Docs.Code Samples
PageBlobItem pageBlob = client.create(size); System.out.printf("Created page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
size
- Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a 512-byte boundary.- Returns:
- The information of the created page blob.
-
create
Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. For more information, see the Azure Docs.Code Samples
boolean overwrite = false; // Default value PageBlobItem pageBlob = client.create(size, overwrite); System.out.printf("Created page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
size
- Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a 512-byte boundary.overwrite
- Whether or not to overwrite, should data exist on the blob.- Returns:
- The information of the created page blob.
-
createWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> createWithResponse(long size, Long sequenceNumber, BlobHttpHeaders headers, Map<String, String> metadata, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. For more information, see the Azure Docs.To avoid overwriting, pass "*" to
BlobRequestConditions.setIfNoneMatch(String)
.Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentLanguage("en-US") .setContentType("binary"); BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageBlobItem pageBlob = client .createWithResponse(size, sequenceNumber, headers, metadata, blobRequestConditions, timeout, context) .getValue(); System.out.printf("Created page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
size
- Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a 512-byte boundary.sequenceNumber
- A user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1.The default value is 0.headers
-BlobHttpHeaders
metadata
- Metadata to associate with the blob. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.requestConditions
-BlobRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The information of the created page blob.
-
createWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> createWithResponse(PageBlobCreateOptions options, Duration timeout, com.azure.core.util.Context context) Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. For more information, see the Azure Docs.To avoid overwriting, pass "*" to
BlobRequestConditions.setIfNoneMatch(String)
.Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentLanguage("en-US") .setContentType("binary"); BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageBlobItem pageBlob = client .createWithResponse(new PageBlobCreateOptions(size).setSequenceNumber(sequenceNumber) .setHeaders(headers).setMetadata(metadata).setTags(tags) .setRequestConditions(blobRequestConditions), timeout, context) .getValue(); System.out.printf("Created page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
options
-PageBlobCreateOptions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The information of the created page blob.
-
createIfNotExists
Creates a page blob of the specified length if it does not exist. Call PutPage to upload data to a page blob. For more information, see the Azure Docs.Code Samples
PageBlobItem pageBlob = client.createIfNotExists(size); System.out.printf("Created page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
size
- Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a 512-byte boundary.- Returns:
PageBlobItem
containing information of the created page blob.
-
createIfNotExistsWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> createIfNotExistsWithResponse(PageBlobCreateOptions options, Duration timeout, com.azure.core.util.Context context) Creates a page blob of the specified length if it does not exist. Call PutPage to upload data to a page blob. For more information, see the Azure Docs.Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentLanguage("en-US") .setContentType("binary"); Context context = new Context(key, value); Response<PageBlobItem> response = client.createIfNotExistsWithResponse(new PageBlobCreateOptions(size) .setHeaders(headers).setMetadata(metadata).setTags(tags), timeout, context); if (response.getStatusCode() == 409) { System.out.println("Already existed."); } else { System.out.printf("Create completed with status %d%n", response.getStatusCode()); }
- Parameters:
options
-PageBlobCreateOptions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A reactive
Response
signaling completion, whosevalue
contains aPageBlobItem
containing information about the page blob. IfResponse
's status code is 201, a new page blob was successfully created. If status code is 409, a page blob already existed at this location.
-
uploadPages
Writes one or more pages to the page blob. The write size must be a multiple of 512. For more information, see the Azure Docs.Note that the data passed must be replayable if retries are enabled (the default). In other words, the
Flux
must produce the same data each time it is subscribed to.Code Samples
PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); PageBlobItem pageBlob = client.uploadPages(pageRange, dataStream); System.out.printf("Uploaded page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
pageRange
- APageRange
object. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are 0-511, 512-1023, etc.body
- The data to upload. The data must be markable. This is in order to support retries. If the data is not markable, consider usinggetBlobOutputStream(PageRange)
and writing to the returned OutputStream. Alternatively, consider wrapping your data source in aBufferedInputStream
to add mark support.- Returns:
- The information of the uploaded pages.
-
uploadPagesWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> uploadPagesWithResponse(PageRange pageRange, InputStream body, byte[] contentMd5, PageBlobRequestConditions pageBlobRequestConditions, Duration timeout, com.azure.core.util.Context context) Writes one or more pages to the page blob. The write size must be a multiple of 512. For more information, see the Azure Docs.Note that the data passed must be replayable if retries are enabled (the default). In other words, the
Flux
must produce the same data each time it is subscribed to.Code Samples
byte[] md5 = MessageDigest.getInstance("MD5").digest("data".getBytes(StandardCharsets.UTF_8)); PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); PageBlobRequestConditions pageBlobRequestConditions = new PageBlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageBlobItem pageBlob = client .uploadPagesWithResponse(pageRange, dataStream, md5, pageBlobRequestConditions, timeout, context).getValue(); System.out.printf("Uploaded page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
pageRange
- APageRange
object. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are 0-511, 512-1023, etc.body
- The data to upload. The data must be markable. This is in order to support retries. If the data is not markable, consider usinggetBlobOutputStream(PageRange)
and writing to the returned OutputStream. Alternatively, consider wrapping your data source in aBufferedInputStream
to add mark support.contentMd5
- An MD5 hash of the page content. This hash is used to verify the integrity of the page during transport. When this header is specified, the storage service compares the hash of the content that has arrived with this header value. Note that this MD5 hash is not stored with the blob. If the two hashes do not match, the operation will fail.pageBlobRequestConditions
-PageBlobRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The information of the uploaded pages.
- Throws:
com.azure.core.exception.UnexpectedLengthException
- when the length of data does not match the inputlength
.NullPointerException
- if the input data is null.
-
uploadPagesFromUrl
Writes one or more pages from the source page blob to this page blob. The write size must be a multiple of 512. For more information, see the Azure Docs.Code Samples
PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); PageBlobItem pageBlob = client.uploadPagesFromUrl(pageRange, url, sourceOffset); System.out.printf("Uploaded page blob from URL with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
range
- APageRange
object. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are 0-511, 512-1023, etc.sourceUrl
- The url to the blob that will be the source of the copy. A source blob in the same storage account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob must either be public or must be authenticated via a shared access signature. If the source blob is public, no authentication is required to perform the operation.sourceOffset
- The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob.- Returns:
- The information of the uploaded pages.
- Throws:
IllegalArgumentException
- IfsourceUrl
is a malformedURL
.
-
uploadPagesFromUrlWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> uploadPagesFromUrlWithResponse(PageRange range, String sourceUrl, Long sourceOffset, byte[] sourceContentMd5, PageBlobRequestConditions destRequestConditions, BlobRequestConditions sourceRequestConditions, Duration timeout, com.azure.core.util.Context context) Writes one or more pages from the source page blob to this page blob. The write size must be a multiple of 512. For more information, see the Azure Docs.Code Samples
PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); byte[] sourceContentMD5 = new byte[512]; PageBlobRequestConditions pageBlobRequestConditions = new PageBlobRequestConditions().setLeaseId(leaseId); BlobRequestConditions sourceRequestConditions = new BlobRequestConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); Context context = new Context(key, value); PageBlobItem pageBlob = client .uploadPagesFromUrlWithResponse(pageRange, url, sourceOffset, sourceContentMD5, pageBlobRequestConditions, sourceRequestConditions, timeout, context).getValue(); System.out.printf("Uploaded page blob from URL with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
range
- The destinationPageRange
range. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are 0-511, 512-1023, etc.sourceUrl
- The url to the blob that will be the source of the copy. A source blob in the same storage account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob must either be public or must be authenticated via a shared access signature. If the source blob is public, no authentication is required to perform the operation.sourceOffset
- The source offset to copy from. Pass null or 0 to copy from the beginning of source blob.sourceContentMd5
- An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 of the received data and fail the request if it does not match the provided MD5.destRequestConditions
-PageBlobRequestConditions
sourceRequestConditions
-BlobRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The information of the uploaded pages.
- Throws:
IllegalArgumentException
- IfsourceUrl
is a malformedURL
.
-
uploadPagesFromUrlWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> uploadPagesFromUrlWithResponse(PageBlobUploadPagesFromUrlOptions options, Duration timeout, com.azure.core.util.Context context) Writes one or more pages from the source page blob to this page blob. The write size must be a multiple of 512. For more information, see the Azure Docs.Code Samples
PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); byte[] sourceContentMD5 = new byte[512]; PageBlobRequestConditions pageBlobRequestConditions = new PageBlobRequestConditions().setLeaseId(leaseId); BlobRequestConditions sourceRequestConditions = new BlobRequestConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); Context context = new Context(key, value); PageBlobItem pageBlob = client .uploadPagesFromUrlWithResponse(new PageBlobUploadPagesFromUrlOptions(pageRange, url) .setSourceOffset(sourceOffset).setSourceContentMd5(sourceContentMD5) .setDestinationRequestConditions(pageBlobRequestConditions) .setSourceRequestConditions(sourceRequestConditions), timeout, context).getValue(); System.out.printf("Uploaded page blob from URL with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
options
- Parameters for the operation.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The information of the uploaded pages.
- Throws:
IllegalArgumentException
- IfsourceUrl
is a malformedURL
.
-
clearPages
Frees the specified pages from the page blob. The size of the range must be a multiple of 512. For more information, see the Azure Docs.Code Samples
PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); PageBlobItem pageBlob = client.clearPages(pageRange); System.out.printf("Cleared page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
pageRange
- APageRange
object. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are 0-511, 512-1023, etc.- Returns:
- The information of the cleared pages.
-
clearPagesWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> clearPagesWithResponse(PageRange pageRange, PageBlobRequestConditions pageBlobRequestConditions, Duration timeout, com.azure.core.util.Context context) Frees the specified pages from the page blob. The size of the range must be a multiple of 512. For more information, see the Azure Docs.Code Samples
PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); PageBlobRequestConditions pageBlobRequestConditions = new PageBlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageBlobItem pageBlob = client .clearPagesWithResponse(pageRange, pageBlobRequestConditions, timeout, context).getValue(); System.out.printf("Cleared page blob with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
pageRange
- APageRange
object. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are 0-511, 512-1023, etc.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.pageBlobRequestConditions
-PageBlobRequestConditions
context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The information of the cleared pages.
-
getPageRanges
Deprecated.Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the Azure Docs.Code Samples
BlobRange blobRange = new BlobRange(offset); PageList pageList = client.getPageRanges(blobRange); System.out.println("Valid Page Ranges are:"); for (PageRange pageRange : pageList.getPageRange()) { System.out.printf("Start: %s, End: %s%n", pageRange.getStart(), pageRange.getEnd()); }
- Parameters:
blobRange
-BlobRange
- Returns:
- The information of the cleared pages.
-
getPageRangesWithResponse
@Deprecated public com.azure.core.http.rest.Response<PageList> getPageRangesWithResponse(BlobRange blobRange, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Deprecated.Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the Azure Docs.Code Samples
BlobRange blobRange = new BlobRange(offset); BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageList pageList = client .getPageRangesWithResponse(blobRange, blobRequestConditions, timeout, context).getValue(); System.out.println("Valid Page Ranges are:"); for (PageRange pageRange : pageList.getPageRange()) { System.out.printf("Start: %s, End: %s%n", pageRange.getStart(), pageRange.getEnd()); }
- Parameters:
blobRange
-BlobRange
requestConditions
-BlobRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- All the page ranges.
-
listPageRanges
Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the Azure Docs.Code Samples
BlobRange blobRange = new BlobRange(offset); String prevSnapshot = "previous snapshot"; PagedIterable<PageRangeItem> iterable = client.listPageRanges(blobRange); for (PageRangeItem item : iterable) { System.out.printf("Offset: %s, Length: %s, isClear: %s%n", item.getRange().getOffset(), item.getRange().getLength(), item.isClear()); }
- Parameters:
blobRange
-BlobRange
- Returns:
- A reactive response containing the information of the cleared pages.
-
listPageRanges
public com.azure.core.http.rest.PagedIterable<PageRangeItem> listPageRanges(ListPageRangesOptions options, Duration timeout, com.azure.core.util.Context context) Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the Azure Docs.Code Samples
ListPageRangesOptions options = new ListPageRangesOptions(new BlobRange(offset)) .setRequestConditions(new BlobRequestConditions().setLeaseId(leaseId)) .setMaxResultsPerPage(1000); Context context = new Context(key, value); PagedIterable<PageRangeItem> iter = client .listPageRanges(options, timeout, context); System.out.println("Valid Page Ranges are:"); for (PageRangeItem item : iter) { System.out.printf("Offset: %s, Length: %s, isClear: %s%n", item.getRange().getOffset(), item.getRange().getLength(), item.isClear()); }
- Parameters:
options
-ListPageRangesOptions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A reactive response emitting all the page ranges.
-
getPageRangesDiff
Deprecated.Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more information, see the Azure Docs.Code Samples
BlobRange blobRange = new BlobRange(offset); final String prevSnapshot = "previous snapshot"; PageList pageList = client.getPageRangesDiff(blobRange, prevSnapshot); System.out.println("Valid Page Ranges are:"); for (PageRange pageRange : pageList.getPageRange()) { System.out.printf("Start: %s, End: %s%n", pageRange.getStart(), pageRange.getEnd()); }
- Parameters:
blobRange
-BlobRange
prevSnapshot
- Specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two.- Returns:
- All the different page ranges.
-
getPageRangesDiffWithResponse
@Deprecated public com.azure.core.http.rest.Response<PageList> getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Deprecated.This API only works for managed disk accounts.Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more information, see the Azure Docs.
Code Samples
BlobRange blobRange = new BlobRange(offset); final String prevSnapshot = "previous snapshot"; BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageList pageList = client .getPageRangesDiffWithResponse(blobRange, prevSnapshot, blobRequestConditions, timeout, context).getValue(); System.out.println("Valid Page Ranges are:"); for (PageRange pageRange : pageList.getPageRange()) { System.out.printf("Start: %s, End: %s%n", pageRange.getStart(), pageRange.getEnd()); }
- Parameters:
blobRange
-BlobRange
prevSnapshot
- Specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two.requestConditions
-BlobRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- All the different page ranges.
-
listPageRangesDiff
public com.azure.core.http.rest.PagedIterable<PageRangeItem> listPageRangesDiff(BlobRange blobRange, String prevSnapshot) Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more information, see the Azure Docs.Code Samples
BlobRange blobRange = new BlobRange(offset); String prevSnapshot = "previous snapshot"; PagedIterable<PageRangeItem> iterable = client.listPageRangesDiff(blobRange, prevSnapshot); for (PageRangeItem item : iterable) { System.out.printf("Offset: %s, Length: %s, isClear: %s%n", item.getRange().getOffset(), item.getRange().getLength(), item.isClear()); }
- Parameters:
blobRange
-BlobRange
prevSnapshot
- Specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two.- Returns:
- A reactive response emitting all the different page ranges.
-
listPageRangesDiff
public com.azure.core.http.rest.PagedIterable<PageRangeItem> listPageRangesDiff(ListPageRangesDiffOptions options, Duration timeout, com.azure.core.util.Context context) Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more information, see the Azure Docs.Code Samples
ListPageRangesDiffOptions options = new ListPageRangesDiffOptions(new BlobRange(offset), "previous snapshot") .setRequestConditions(new BlobRequestConditions().setLeaseId(leaseId)) .setMaxResultsPerPage(1000); Context context = new Context(key, value); PagedIterable<PageRangeItem> iter = client .listPageRangesDiff(options, timeout, context); System.out.println("Valid Page Ranges are:"); for (PageRangeItem item : iter) { System.out.printf("Offset: %s, Length: %s, isClear: %s%n", item.getRange().getOffset(), item.getRange().getLength(), item.isClear()); }
- Parameters:
options
-ListPageRangesDiffOptions
.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A reactive response emitting all the different page ranges.
- Throws:
IllegalArgumentException
- IfprevSnapshot
isnull
-
getManagedDiskPageRangesDiff
This API only works for managed disk accounts.Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more information, see the Azure Docs.
Code Samples
BlobRange blobRange = new BlobRange(offset); final String prevSnapshotUrl = "previous snapshot url"; PageList pageList = client.getPageRangesDiff(blobRange, prevSnapshotUrl); System.out.println("Valid Page Ranges are:"); for (PageRange pageRange : pageList.getPageRange()) { System.out.printf("Start: %s, End: %s%n", pageRange.getStart(), pageRange.getEnd()); }
- Parameters:
blobRange
-BlobRange
prevSnapshotUrl
- Specifies the URL of a previous snapshot of the target blob. Specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two.- Returns:
- All the different page ranges.
-
getManagedDiskPageRangesDiffWithResponse
public com.azure.core.http.rest.Response<PageList> getManagedDiskPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshotUrl, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) This API only works for managed disk accounts.Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more information, see the Azure Docs.
Code Samples
BlobRange blobRange = new BlobRange(offset); final String prevSnapshotUrl = "previous snapshot url"; BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageList pageList = client .getPageRangesDiffWithResponse(blobRange, prevSnapshotUrl, blobRequestConditions, timeout, context).getValue(); System.out.println("Valid Page Ranges are:"); for (PageRange pageRange : pageList.getPageRange()) { System.out.printf("Start: %s, End: %s%n", pageRange.getStart(), pageRange.getEnd()); }
- Parameters:
blobRange
-BlobRange
prevSnapshotUrl
- Specifies the URL of a previous snapshot of the target blob. Specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two.requestConditions
-BlobRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- All the different page ranges.
-
resize
Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the Azure Docs.Code Samples
PageBlobItem pageBlob = client.resize(size); System.out.printf("Page blob resized with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
size
- Resizes a page blob to the specified size. If the specified value is less than the current size of the blob, then all pages above the specified value are cleared.- Returns:
- The resized page blob.
-
resizeWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> resizeWithResponse(long size, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the Azure Docs.Code Samples
BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageBlobItem pageBlob = client .resizeWithResponse(size, blobRequestConditions, timeout, context).getValue(); System.out.printf("Page blob resized with sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
size
- Resizes a page blob to the specified size. If the specified value is less than the current size of the blob, then all pages above the specified value are cleared.requestConditions
-BlobRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The resized page blob.
-
updateSequenceNumber
Sets the page blob's sequence number. For more information, see the Azure Docs.Code Samples
PageBlobItem pageBlob = client.updateSequenceNumber(SequenceNumberActionType.INCREMENT, size); System.out.printf("Page blob updated to sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
action
- Indicates how the service should modify the blob's sequence number.sequenceNumber
- The blob's sequence number. The sequence number is a user-controlled property that you can use to track requests and manage concurrency issues.- Returns:
- The updated page blob.
-
updateSequenceNumberWithResponse
public com.azure.core.http.rest.Response<PageBlobItem> updateSequenceNumberWithResponse(SequenceNumberActionType action, Long sequenceNumber, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Sets the page blob's sequence number. For more information, see the Azure Docs.Code Samples
BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId(leaseId); Context context = new Context(key, value); PageBlobItem pageBlob = client.updateSequenceNumberWithResponse( SequenceNumberActionType.INCREMENT, size, blobRequestConditions, timeout, context).getValue(); System.out.printf("Page blob updated to sequence number %s%n", pageBlob.getBlobSequenceNumber());
- Parameters:
action
- Indicates how the service should modify the blob's sequence number.sequenceNumber
- The blob's sequence number. The sequence number is a user-controlled property that you can use to track requests and manage concurrency issues.requestConditions
-BlobRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The updated page blob.
-
copyIncremental
Begins an operation to start an incremental copy from one page blob's snapshot to this page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. For more information, see the Azure Docs here and here.Code Samples
final String snapshot = "copy snapshot"; CopyStatusType statusType = client.copyIncremental(url, snapshot); switch (statusType) { case SUCCESS: System.out.println("Page blob copied successfully"); break; case FAILED: System.out.println("Page blob copied failed"); break; case ABORTED: System.out.println("Page blob copied aborted"); break; case PENDING: System.out.println("Page blob copied pending"); break; default: break; }
- Parameters:
source
- The source page blob.snapshot
- The snapshot on the copy source.- Returns:
- The copy status.
- Throws:
IllegalArgumentException
- Ifsource
is a malformedURL
.
-
copyIncrementalWithResponse
public com.azure.core.http.rest.Response<CopyStatusType> copyIncrementalWithResponse(String source, String snapshot, com.azure.core.http.RequestConditions modifiedRequestConditions, Duration timeout, com.azure.core.util.Context context) Begins an operation to start an incremental copy from one page blob's snapshot to this page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. For more information, see the Azure Docs here and here.Code Samples
final String snapshot = "copy snapshot"; RequestConditions modifiedRequestConditions = new RequestConditions() .setIfNoneMatch("snapshotMatch"); Context context = new Context(key, value); CopyStatusType statusType = client .copyIncrementalWithResponse(url, snapshot, modifiedRequestConditions, timeout, context).getValue(); switch (statusType) { case SUCCESS: System.out.println("Page blob copied successfully"); break; case FAILED: System.out.println("Page blob copied failed"); break; case ABORTED: System.out.println("Page blob copied aborted"); break; case PENDING: System.out.println("Page blob copied pending"); break; default: break; }
- Parameters:
source
- The source page blob.snapshot
- The snapshot on the copy source.modifiedRequestConditions
- Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given request. The request will fail if the specified condition is not satisfied.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The copy status.
- Throws:
IllegalArgumentException
- Ifsource
is a malformedURL
.
-
copyIncrementalWithResponse
public com.azure.core.http.rest.Response<CopyStatusType> copyIncrementalWithResponse(PageBlobCopyIncrementalOptions options, Duration timeout, com.azure.core.util.Context context) Begins an operation to start an incremental copy from one page blob's snapshot to this page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. For more information, see the Azure Docs here and here.Code Samples
final String snapshot = "copy snapshot"; PageBlobCopyIncrementalRequestConditions destinationRequestConditions = new PageBlobCopyIncrementalRequestConditions() .setIfNoneMatch("snapshotMatch"); Context context = new Context(key, value); CopyStatusType statusType = client .copyIncrementalWithResponse(new PageBlobCopyIncrementalOptions(url, snapshot) .setRequestConditions(destinationRequestConditions), timeout, context).getValue(); switch (statusType) { case SUCCESS: System.out.println("Page blob copied successfully"); break; case FAILED: System.out.println("Page blob copied failed"); break; case ABORTED: System.out.println("Page blob copied aborted"); break; case PENDING: System.out.println("Page blob copied pending"); break; default: break; }
- Parameters:
options
-PageBlobCopyIncrementalOptions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The copy status.
- Throws:
IllegalArgumentException
- Ifsource
is a malformedURL
.
-
listPageRanges(BlobRange)