Class PageBlobAsyncClient

java.lang.Object
com.azure.storage.blob.specialized.BlobAsyncClientBase
com.azure.storage.blob.specialized.PageBlobAsyncClient

public final class PageBlobAsyncClient extends BlobAsyncClientBase
Client to a page blob. It may only be instantiated through a SpecializedBlobClientBuilder or via the method BlobAsyncClient.getPageBlobAsyncClient(). 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.

Note this client is an async client that returns reactive responses from Spring Reactor Core project (https://projectreactor.io/). Calling the methods in this client will NOT start the actual network operation, until .subscribe() is called on the reactive response. You can simply convert one of these responses to a CompletableFuture object through Mono.toFuture().

  • Field Details

    • PAGE_BYTES

      public static final int PAGE_BYTES
      Indicates the number of bytes in a page.
      See Also:
    • MAX_PUT_PAGES_BYTES

      public static final int MAX_PUT_PAGES_BYTES
      Indicates the maximum number of bytes that may be sent in a call to putPage.
      See Also:
  • Method Details

    • getEncryptionScopeAsyncClient

      public PageBlobAsyncClient getEncryptionScopeAsyncClient(String encryptionScope)
      Creates a new PageBlobAsyncClient with the specified encryptionScope.
      Overrides:
      getEncryptionScopeAsyncClient in class BlobAsyncClientBase
      Parameters:
      encryptionScope - the encryption scope for the blob, pass null to use no encryption scope.
      Returns:
      a PageBlobAsyncClient with the specified encryptionScope.
    • getCustomerProvidedKeyAsyncClient

      public PageBlobAsyncClient getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey)
      Creates a new PageBlobAsyncClient with the specified customerProvidedKey.
      Overrides:
      getCustomerProvidedKeyAsyncClient in class BlobAsyncClientBase
      Parameters:
      customerProvidedKey - the CustomerProvidedKey for the blob, pass null to use no customer provided key.
      Returns:
      a PageBlobAsyncClient with the specified customerProvidedKey.
    • create

      public Mono<PageBlobItem> create(long size)
      Creates a page blob of the specified length. By default, this method will not overwrite an existing blob. Call PutPage to upload data to a page blob. For more information, see the Azure Docs.

      Code Samples

       client.create(size).subscribe(response -> System.out.printf(
           "Created page blob with sequence number %s%n", response.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:
      A reactive response containing the information of the created page blob.
    • create

      public Mono<PageBlobItem> create(long size, boolean overwrite)
      Creates a page blob of the specified length. Call PutPage to upload data to a page blob. For more information, see the Azure Docs.

      Code Samples

       boolean overwrite = false; // Default behavior
       client.create(size, overwrite).subscribe(response -> System.out.printf(
           "Created page blob with sequence number %s%n", response.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 to overwrite, should data exist on the blob.
      Returns:
      A reactive response containing the information of the created page blob.
    • createWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> createWithResponse(long size, Long sequenceNumber, BlobHttpHeaders headers, Map<String,String> metadata, BlobRequestConditions requestConditions)
      Creates a page blob of the specified length. Call PutPage to upload 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);
      
       client.createWithResponse(size, sequenceNumber, headers, metadata, blobRequestConditions)
           .subscribe(response -> System.out.printf(
               "Created page blob with sequence number %s%n", response.getValue().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
      Returns:
      A reactive response containing the information of the created page blob.
      Throws:
      IllegalArgumentException - If size isn't a multiple of PAGE_BYTES or sequenceNumber isn't null and is less than 0.
    • createWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> createWithResponse(PageBlobCreateOptions options)
      Creates a page blob of the specified length. Call PutPage to upload 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);
      
       client.createWithResponse(new PageBlobCreateOptions(size).setSequenceNumber(sequenceNumber)
           .setHeaders(headers).setMetadata(metadata).setTags(tags).setRequestConditions(blobRequestConditions))
           .subscribe(response -> System.out.printf(
               "Created page blob with sequence number %s%n", response.getValue().getBlobSequenceNumber()));
      
       
      Parameters:
      options - PageBlobCreateOptions
      Returns:
      A reactive response containing the information of the created page blob.
      Throws:
      IllegalArgumentException - If size isn't a multiple of PAGE_BYTES or sequenceNumber isn't null and is less than 0.
    • createIfNotExists

      public Mono<PageBlobItem> createIfNotExists(long size)
      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

       client.createIfNotExists(size).subscribe(response ->
           System.out.printf("Created page blob with sequence number %s%n", response.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:
      A reactive response Mono signaling completion. PageBlobItem contains information of the newly created page blob.
    • createIfNotExistsWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> createIfNotExistsWithResponse(PageBlobCreateOptions options)
      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");
      
       client.createIfNotExistsWithResponse(new PageBlobCreateOptions(size).setSequenceNumber(sequenceNumber)
           .setHeaders(headers).setMetadata(metadata).setTags(tags)).subscribe(response -> {
               if (response.getStatusCode() == 409) {
                   System.out.println("Already exists.");
               } else {
                   System.out.println("successfully created.");
               }
           });
       
      Parameters:
      options - PageBlobCreateOptions
      Returns:
      A Mono containing Response signaling completion, whose value contains a PageBlobItem containing information about the page blob. If Response'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.
      Throws:
      IllegalArgumentException - If size isn't a multiple of PAGE_BYTES or sequenceNumber isn't null and is less than 0.
    • uploadPages

      public Mono<PageBlobItem> uploadPages(PageRange pageRange, Flux<ByteBuffer> body)
      Writes one or more pages to the page blob. 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);
      
       client.uploadPages(pageRange, body).subscribe(response -> System.out.printf(
           "Uploaded page blob with sequence number %s%n", response.getBlobSequenceNumber()));
       
      Parameters:
      pageRange - A PageRange 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. Note that this Flux must be replayable if retries are enabled (the default). In other words, the Flowable must produce the same data each time it is subscribed to.
      Returns:
      A reactive response containing the information of the uploaded pages.
    • uploadPagesWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> uploadPagesWithResponse(PageRange pageRange, Flux<ByteBuffer> body, byte[] contentMd5, PageBlobRequestConditions pageBlobRequestConditions)
      Writes one or more pages to the page blob. 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);
      
       byte[] md5 = MessageDigest.getInstance("MD5").digest("data".getBytes(StandardCharsets.UTF_8));
       PageBlobRequestConditions pageBlobRequestConditions = new PageBlobRequestConditions().setLeaseId(leaseId);
      
       client.uploadPagesWithResponse(pageRange, body, md5, pageBlobRequestConditions)
           .subscribe(response -> System.out.printf(
               "Uploaded page blob with sequence number %s%n", response.getValue().getBlobSequenceNumber()));
       
      Parameters:
      pageRange - A PageRange 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. Note that this Flux must be replayable if retries are enabled (the default). In other words, the Flowable must produce the same data each time it is subscribed to.
      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
      Returns:
      A reactive response containing the information of the uploaded pages.
      Throws:
      IllegalArgumentException - If pageRange is null
    • uploadPagesFromUrl

      public Mono<PageBlobItem> uploadPagesFromUrl(PageRange range, String sourceUrl, Long sourceOffset)
      Writes one or more pages from the source page blob to this page blob. 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);
      
       client.uploadPagesFromUrl(pageRange, url, sourceOffset)
           .subscribe(response -> System.out.printf(
               "Uploaded page blob from URL with sequence number %s%n", response.getBlobSequenceNumber()));
       
      Parameters:
      range - A PageRange 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:
      A reactive response containing the information of the uploaded pages.
    • uploadPagesFromUrlWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> uploadPagesFromUrlWithResponse(PageRange range, String sourceUrl, Long sourceOffset, byte[] sourceContentMd5, PageBlobRequestConditions destRequestConditions, BlobRequestConditions sourceRequestConditions)
      Writes one or more pages from the source page blob to this page blob. 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));
      
       client.uploadPagesFromUrlWithResponse(pageRange, url, sourceOffset, sourceContentMD5, pageBlobRequestConditions,
               sourceRequestConditions)
           .subscribe(response -> System.out.printf(
               "Uploaded page blob from URL with sequence number %s%n", response.getValue().getBlobSequenceNumber()));
       
      Parameters:
      range - The destination PageRange 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 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.
      destRequestConditions - PageBlobRequestConditions
      sourceRequestConditions - BlobRequestConditions
      Returns:
      A reactive response containing the information of the uploaded pages.
      Throws:
      IllegalArgumentException - If range is null
    • uploadPagesFromUrlWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> uploadPagesFromUrlWithResponse(PageBlobUploadPagesFromUrlOptions options)
      Writes one or more pages from the source page blob to this page blob. 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));
      
       client.uploadPagesFromUrlWithResponse(new PageBlobUploadPagesFromUrlOptions(pageRange, url)
           .setSourceOffset(sourceOffset).setSourceContentMd5(sourceContentMD5)
           .setDestinationRequestConditions(pageBlobRequestConditions)
           .setSourceRequestConditions(sourceRequestConditions))
           .subscribe(response -> System.out.printf(
               "Uploaded page blob from URL with sequence number %s%n", response.getValue().getBlobSequenceNumber()));
       
      Parameters:
      options - Parameters for the operation.
      Returns:
      A reactive response containing the information of the uploaded pages.
      Throws:
      IllegalArgumentException - If range is null
    • clearPages

      public Mono<PageBlobItem> clearPages(PageRange pageRange)
      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);
      
       client.clearPages(pageRange).subscribe(response -> System.out.printf(
           "Cleared page blob with sequence number %s%n", response.getBlobSequenceNumber()));
       
      Parameters:
      pageRange - A PageRange 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 reactive response containing the information of the cleared pages.
    • clearPagesWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> clearPagesWithResponse(PageRange pageRange, PageBlobRequestConditions pageBlobRequestConditions)
      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);
      
       client.clearPagesWithResponse(pageRange, pageBlobRequestConditions)
           .subscribe(response -> System.out.printf(
               "Cleared page blob with sequence number %s%n", response.getValue().getBlobSequenceNumber()));
       
      Parameters:
      pageRange - A PageRange 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.
      pageBlobRequestConditions - PageBlobRequestConditions
      Returns:
      A reactive response containing the information of the cleared pages.
      Throws:
      IllegalArgumentException - If pageRange is null
    • getPageRanges

      @Deprecated public Mono<PageList> getPageRanges(BlobRange blobRange)
      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);
      
       client.getPageRanges(blobRange).subscribe(response -> {
           System.out.println("Valid Page Ranges are:");
           for (PageRange pageRange : response.getPageRange()) {
               System.out.printf("Start: %s, End: %s%n", pageRange.getStart(), pageRange.getEnd());
           }
       });
       
      Parameters:
      blobRange - BlobRange
      Returns:
      A reactive response containing the information of the cleared pages.
    • getPageRangesWithResponse

      @Deprecated public Mono<com.azure.core.http.rest.Response<PageList>> getPageRangesWithResponse(BlobRange blobRange, BlobRequestConditions requestConditions)
      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);
      
       client.getPageRangesWithResponse(blobRange, blobRequestConditions)
           .subscribe(response -> {
               System.out.println("Valid Page Ranges are:");
               for (PageRange pageRange : response.getValue().getPageRange()) {
                   System.out.printf("Start: %s, End: %s%n", pageRange.getStart(), pageRange.getEnd());
               }
           });
       
      Parameters:
      blobRange - BlobRange
      requestConditions - BlobRequestConditions
      Returns:
      A reactive response emitting all the page ranges.
    • listPageRanges

      public com.azure.core.http.rest.PagedFlux<PageRangeItem> listPageRanges(BlobRange blobRange)
      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);
      
       System.out.println("Valid Page Ranges are:");
       client.listPageRanges(blobRange).subscribe(rangeItem -> System.out.printf("Offset: %s, Length: %s%n",
           rangeItem.getRange().getOffset(), rangeItem.getRange().getLength()));
       
      Parameters:
      blobRange - BlobRange
      Returns:
      A reactive response containing the information of the cleared pages.
    • listPageRanges

      public com.azure.core.http.rest.PagedFlux<PageRangeItem> listPageRanges(ListPageRangesOptions options)
      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))
           .setMaxResultsPerPage(1000).setRequestConditions(new BlobRequestConditions().setLeaseId(leaseId));
      
       client.listPageRanges(options)
           .subscribe(rangeItem -> System.out.printf("Offset: %s, Length: %s%n", rangeItem.getRange().getOffset(),
               rangeItem.getRange().getLength()));
       
      Parameters:
      options - ListPageRangesOptions
      Returns:
      A reactive response emitting all the page ranges.
    • getPageRangesDiff

      @Deprecated public Mono<PageList> getPageRangesDiff(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);
       final String prevSnapshot = "previous snapshot";
      
       client.getPageRangesDiff(blobRange, prevSnapshot).subscribe(response -> {
           System.out.println("Valid Page Ranges are:");
           for (PageRange pageRange : response.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:
      A reactive response emitting all the different page ranges.
    • getPageRangesDiffWithResponse

      @Deprecated public Mono<com.azure.core.http.rest.Response<PageList>> getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, BlobRequestConditions requestConditions)
      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);
      
       client.getPageRangesDiffWithResponse(blobRange, prevSnapshot, blobRequestConditions)
           .subscribe(response -> {
               System.out.println("Valid Page Ranges are:");
               for (PageRange pageRange : response.getValue().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
      Returns:
      A reactive response emitting all the different page ranges.
      Throws:
      IllegalArgumentException - If prevSnapshot is null
    • listPageRangesDiff

      public com.azure.core.http.rest.PagedFlux<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";
      
       System.out.println("Valid Page Ranges are:");
       client.listPageRangesDiff(blobRange, prevSnapshot).subscribe(rangeItem ->
           System.out.printf("Offset: %s, Length: %s, isClear: %s%n",
           rangeItem.getRange().getOffset(), rangeItem.getRange().getLength(), rangeItem.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.PagedFlux<PageRangeItem> listPageRangesDiff(ListPageRangesDiffOptions options)
      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);
      
       client.listPageRangesDiff(options)
           .subscribe(rangeItem -> System.out.printf("Offset: %s, Length: %s, isClear: %s%n",
               rangeItem.getRange().getOffset(), rangeItem.getRange().getLength(), rangeItem.isClear()));
       
      Parameters:
      options - ListPageRangesDiffOptions.
      Returns:
      A reactive response emitting all the different page ranges.
      Throws:
      IllegalArgumentException - If prevSnapshot is null
    • getManagedDiskPageRangesDiff

      public Mono<PageList> getManagedDiskPageRangesDiff(BlobRange blobRange, String prevSnapshotUrl)
      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";
      
       client.getPageRangesDiff(blobRange, prevSnapshotUrl).subscribe(response -> {
           System.out.println("Valid Page Ranges are:");
           for (PageRange pageRange : response.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:
      A reactive response emitting all the different page ranges.
    • getManagedDiskPageRangesDiffWithResponse

      public Mono<com.azure.core.http.rest.Response<PageList>> getManagedDiskPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshotUrl, BlobRequestConditions requestConditions)
      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);
      
       client.getPageRangesDiffWithResponse(blobRange, prevSnapshotUrl, blobRequestConditions)
           .subscribe(response -> {
               System.out.println("Valid Page Ranges are:");
               for (PageRange pageRange : response.getValue().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
      Returns:
      A reactive response emitting all the different page ranges.
      Throws:
      IllegalArgumentException - If prevSnapshot is null
    • resize

      public Mono<PageBlobItem> resize(long size)
      Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the Azure Docs.

      Code Samples

       client.resize(size).subscribe(response -> System.out.printf(
           "Page blob resized with sequence number %s%n", response.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:
      A reactive response emitting the resized page blob.
    • resizeWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> resizeWithResponse(long size, BlobRequestConditions requestConditions)
      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);
      
       client.resizeWithResponse(size, blobRequestConditions)
           .subscribe(response -> System.out.printf(
               "Page blob resized with sequence number %s%n", response.getValue().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
      Returns:
      A reactive response emitting the resized page blob.
      Throws:
      IllegalArgumentException - If size isn't a multiple of PAGE_BYTES
    • updateSequenceNumber

      public Mono<PageBlobItem> updateSequenceNumber(SequenceNumberActionType action, Long sequenceNumber)
      Sets the page blob's sequence number. For more information, see the Azure Docs.

      Code Samples

       client.updateSequenceNumber(SequenceNumberActionType.INCREMENT, size)
           .subscribe(response -> System.out.printf(
               "Page blob updated to sequence number %s%n", response.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:
      A reactive response emitting the updated page blob.
    • updateSequenceNumberWithResponse

      public Mono<com.azure.core.http.rest.Response<PageBlobItem>> updateSequenceNumberWithResponse(SequenceNumberActionType action, Long sequenceNumber, BlobRequestConditions requestConditions)
      Sets the page blob's sequence number. For more information, see the Azure Docs.

      Code Samples

       BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId(leaseId);
      
       client.updateSequenceNumberWithResponse(SequenceNumberActionType.INCREMENT, size, blobRequestConditions)
           .subscribe(response -> System.out.printf(
               "Page blob updated to sequence number %s%n", response.getValue().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
      Returns:
      A reactive response emitting the updated page blob.
      Throws:
      IllegalArgumentException - If sequenceNumber isn't null and is less than 0
    • copyIncremental

      public Mono<CopyStatusType> copyIncremental(String source, String snapshot)
      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";
       client.copyIncremental(url, snapshot).subscribe(statusType -> {
           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:
      A reactive response emitting the copy status.
    • copyIncrementalWithResponse

      public Mono<com.azure.core.http.rest.Response<CopyStatusType>> copyIncrementalWithResponse(String source, String snapshot, com.azure.core.http.RequestConditions modifiedRequestConditions)
      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");
      
       client.copyIncrementalWithResponse(url, snapshot, modifiedRequestConditions)
           .subscribe(response -> {
               CopyStatusType statusType = response.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.
      Returns:
      A reactive response emitting the copy status.
      Throws:
      IllegalStateException - If source and snapshot form a malformed URL.
    • copyIncrementalWithResponse

      public Mono<com.azure.core.http.rest.Response<CopyStatusType>> copyIncrementalWithResponse(PageBlobCopyIncrementalOptions options)
      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");
      
       client.copyIncrementalWithResponse(new PageBlobCopyIncrementalOptions(url, snapshot)
           .setRequestConditions(destinationRequestConditions))
           .subscribe(response -> {
               CopyStatusType statusType = response.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
      Returns:
      A reactive response emitting the copy status.
      Throws:
      IllegalStateException - If source and snapshot form a malformed URL.