diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml index cf9849b09b2d..6e33b99b2d3c 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml @@ -274,6 +274,7 @@ page at http://checkstyle.sourceforge.net/config.html --> + diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java index 306f728d44a5..5a262ff3952d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java @@ -71,6 +71,10 @@ public final class AppendBlobAsyncClient extends BlobAsyncClient { /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.create} + * * @return A {@link Mono} containing the information of the created appended blob. */ public Mono create() { @@ -79,6 +83,11 @@ public Mono create() { /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions} + * * @param headers {@link BlobHTTPHeaders} * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} @@ -104,6 +113,11 @@ Mono> createWithResponse(BlobHTTPHeaders headers, Metad *

* Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.appendBlock#Flux-long} + * * @param data The data to write to the blob. Note that this {@code Flux} 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. * @param length The exact length of the data. It is important that this value match precisely the length of the data @@ -120,6 +134,11 @@ public Mono appendBlock(Flux data, long length) { *

* Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.appendBlockWithResponse#Flux-long-AppendBlobAccessConditions} + * * @param data The data to write to the blob. Note that this {@code Flux} 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. * @param length The exact length of the data. It is important that this value match precisely the length of the data @@ -149,6 +168,11 @@ Mono> appendBlockWithResponse(Flux data, lo /** * Commits a new block of data from another blob to the end of this append blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrl#URL-BlobRange} + * * @param 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 @@ -163,6 +187,11 @@ public Mono appendBlockFromUrl(URL sourceURL, BlobRange sourceRa /** * Commits a new block of data from another blob to the end of this append blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions} + * * @param 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 diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java index 66a2fe13eb07..877426a8b7c1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java @@ -92,6 +92,10 @@ public BlobOutputStream getBlobOutputStream(AppendBlobAccessConditions accessCon /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.create} + * * @return The information of the created appended blob. */ public AppendBlobItem create() { @@ -101,6 +105,10 @@ public AppendBlobItem create() { /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.create#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration} + * * @param headers {@link BlobHTTPHeaders} * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} @@ -116,6 +124,10 @@ public AppendBlobItem create(BlobHTTPHeaders headers, Metadata metadata, /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration-Context} + * * @param headers {@link BlobHTTPHeaders} * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} @@ -136,6 +148,10 @@ public Response createWithResponse(BlobHTTPHeaders headers, Meta * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlock#InputStream-long} + * * @param data The data to write to the blob. * @param length The exact length of the data. It is important that this value match precisely the length of the data * emitted by the {@code Flux}. @@ -152,6 +168,10 @@ public AppendBlobItem appendBlock(InputStream data, long length) { * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlockWithResponse#InputStream-long-AppendBlobAccessConditions-Duration-Context} + * * @param data The data to write to the blob. Note that this {@code Flux} 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. * @param length The exact length of the data. It is important that this value match precisely the length of the data @@ -175,6 +195,10 @@ public Response appendBlockWithResponse(InputStream data, long l /** * Commits a new block of data from another blob to the end of this append blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange} + * * @param 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 @@ -190,6 +214,10 @@ public AppendBlobItem appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { /** * Commits a new block of data from another blob to the end of this append blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration} + * * @param 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 @@ -213,6 +241,10 @@ public AppendBlobItem appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, /** * Commits a new block of data from another blob to the end of this append blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context} + * * @param 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 diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..816286925a3c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.blob.models.AppendBlobAccessConditions; +import com.azure.storage.blob.models.AppendPositionAccessConditions; +import com.azure.storage.blob.models.BlobAccessConditions; +import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobRange; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.SourceModifiedAccessConditions; + +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; + +import java.net.URL; +import java.time.OffsetDateTime; +import java.util.Collections; + +/** + * Code snippets for {@link AppendBlobAsyncClient} + */ +public class AppendBlobAsyncClientJavaDocCodeSnippets { + private AppendBlobAsyncClient client = JavaDocCodeSnippetsHelpers.getBlobAsyncClient("blobName") + .asAppendBlobAsyncClient(); + private String leaseId = "leaseId"; + private Flux data = Flux.just(ByteBuffer.wrap("data".getBytes("UTF-8"))); + private long length = 4L; + private static final Long POSITION = null; + private Long maxSize = length; + private URL sourceUrl = JavaDocCodeSnippetsHelpers.generateURL("https://example.com"); + private long offset = 1024; + private long count = 1024; + + /** + * + * @throws UnsupportedEncodingException if cannot get bytes from sample sting as utf-8 encoding + */ + AppendBlobAsyncClientJavaDocCodeSnippets() throws UnsupportedEncodingException { + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#create()} + */ + public void create() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.create + client.create().subscribe(response -> + System.out.printf("Created AppendBlob at %s%n", response.lastModified())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.create + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#createWithResponse(BlobHTTPHeaders, Metadata, BlobAccessConditions)} + */ + public void create2() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .blobContentType("binary") + .blobContentLanguage("en-US"); + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)) + .modifiedAccessConditions(new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + client.createWithResponse(headers, metadata, accessConditions).subscribe(response -> + System.out.printf("Created AppendBlob at %s%n", response.value().lastModified())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#appendBlock(Flux, long)} + */ + public void appendBlock() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.appendBlock#Flux-long + client.appendBlock(data, length).subscribe(response -> + System.out.printf("AppendBlob has %d committed blocks%n", response.blobCommittedBlockCount())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.appendBlock#Flux-long + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#appendBlockWithResponse(Flux, long, AppendBlobAccessConditions)} + */ + public void appendBlock2() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockWithResponse#Flux-long-AppendBlobAccessConditions + AppendBlobAccessConditions accessConditions = new AppendBlobAccessConditions() + .appendPositionAccessConditions(new AppendPositionAccessConditions() + .appendPosition(POSITION) + .maxSize(maxSize)); + + client.appendBlockWithResponse(data, length, accessConditions).subscribe(response -> + System.out.printf("AppendBlob has %d committed blocks%n", response.value().blobCommittedBlockCount())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockWithResponse#Flux-long-AppendBlobAccessConditions + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#appendBlockFromUrl(URL, BlobRange)} + */ + public void appendBlockFromUrl() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrl#URL-BlobRange + client.appendBlockFromUrl(sourceUrl, new BlobRange(offset, count)).subscribe(response -> + System.out.printf("AppendBlob has %d committed blocks%n", response.blobCommittedBlockCount())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrl#URL-BlobRange + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#appendBlockFromUrlWithResponse(URL, BlobRange, byte[], AppendBlobAccessConditions, SourceModifiedAccessConditions)} + */ + public void appendBlockFromUrl2() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions + AppendBlobAccessConditions appendBlobAccessConditions = new AppendBlobAccessConditions() + .appendPositionAccessConditions(new AppendPositionAccessConditions() + .appendPosition(POSITION) + .maxSize(maxSize)); + + SourceModifiedAccessConditions modifiedAccessConditions = new SourceModifiedAccessConditions() + .sourceIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.appendBlockFromUrlWithResponse(sourceUrl, new BlobRange(offset, count), null, + appendBlobAccessConditions, modifiedAccessConditions).subscribe(response -> + System.out.printf("AppendBlob has %d committed blocks%n", response.value().blobCommittedBlockCount())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..96e4a3ed9f14 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobClientJavaDocCodeSnippets.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.util.Context; + +import com.azure.storage.blob.models.AppendBlobAccessConditions; +import com.azure.storage.blob.models.AppendPositionAccessConditions; +import com.azure.storage.blob.models.BlobAccessConditions; +import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobRange; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.SourceModifiedAccessConditions; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Collections; + +/** + * Code snippets for {@link AppendBlobClient} + */ +public class AppendBlobClientJavaDocCodeSnippets { + private AppendBlobClient client = JavaDocCodeSnippetsHelpers.getBlobClient("blobName") + .asAppendBlobClient(); + private Duration timeout = Duration.ofSeconds(30); + private String leaseId = "leaseId"; + private InputStream data = new ByteArrayInputStream("data".getBytes("UTF-8")); + private long length = 4L; + private static final Long POSITION = null; + private Long maxSize = length; + private URL sourceUrl = JavaDocCodeSnippetsHelpers.generateURL("https://example.com"); + private long offset = 1024; + private long count = 1024; + + /** + * + * @throws UnsupportedEncodingException if cannot get bytes from sample sting as utf-8 encoding + */ + AppendBlobClientJavaDocCodeSnippets() throws UnsupportedEncodingException { + } + + /** + * Code snippet for {@link AppendBlobClient#create()} + */ + public void create() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.create + System.out.printf("Created AppendBlob at %s%n", client.create().lastModified()); + // END: com.azure.storage.blob.AppendBlobClient.create + } + + /** + * Code snippet for {@link AppendBlobClient#create(BlobHTTPHeaders, Metadata, BlobAccessConditions, Duration)} + */ + public void create2() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.create#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .blobContentType("binary") + .blobContentLanguage("en-US"); + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)) + .modifiedAccessConditions(new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + System.out.printf("Created AppendBlob at %s%n", + client.create(headers, metadata, accessConditions, timeout).lastModified()); + // END: com.azure.storage.blob.AppendBlobClient.create#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration + } + + /** + * Code snippet for {@link AppendBlobClient#createWithResponse(BlobHTTPHeaders, Metadata, BlobAccessConditions, Duration, Context)} + */ + public void create3() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration-Context + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .blobContentType("binary") + .blobContentLanguage("en-US"); + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)) + .modifiedAccessConditions(new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + Context context = new Context("key", "value"); + + System.out.printf("Created AppendBlob at %s%n", + client.createWithResponse(headers, metadata, accessConditions, timeout, context).value().lastModified()); + // END: com.azure.storage.blob.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlock(InputStream, long)} + */ + public void appendBlock() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlock#InputStream-long + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlock(data, length).blobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlock#InputStream-long + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlockWithResponse(InputStream, long, AppendBlobAccessConditions, Duration, Context)} + */ + public void appendBlock2() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlockWithResponse#InputStream-long-AppendBlobAccessConditions-Duration-Context + AppendBlobAccessConditions accessConditions = new AppendBlobAccessConditions() + .appendPositionAccessConditions(new AppendPositionAccessConditions() + .appendPosition(POSITION) + .maxSize(maxSize)); + Context context = new Context("key", "value"); + + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlockWithResponse(data, length, accessConditions, timeout, context).value().blobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlockWithResponse#InputStream-long-AppendBlobAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlockFromUrl(URL, BlobRange)} + */ + public void appendBlockFromUrl() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlockFromUrl(sourceUrl, new BlobRange(offset, count)).blobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlockFromUrl(URL, BlobRange, byte[], AppendBlobAccessConditions, SourceModifiedAccessConditions, Duration)} + */ + public void appendBlockFromUrl2() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration + AppendBlobAccessConditions appendBlobAccessConditions = new AppendBlobAccessConditions() + .appendPositionAccessConditions(new AppendPositionAccessConditions() + .appendPosition(POSITION) + .maxSize(maxSize)); + + SourceModifiedAccessConditions modifiedAccessConditions = new SourceModifiedAccessConditions() + .sourceIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlockFromUrl(sourceUrl, new BlobRange(offset, count), null, + appendBlobAccessConditions, modifiedAccessConditions, timeout).blobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlockFromUrlWithResponse(URL, BlobRange, byte[], AppendBlobAccessConditions, SourceModifiedAccessConditions, Duration, Context)} + */ + public void appendBlockFromUrl3() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context + AppendBlobAccessConditions appendBlobAccessConditions = new AppendBlobAccessConditions() + .appendPositionAccessConditions(new AppendPositionAccessConditions() + .appendPosition(POSITION) + .maxSize(maxSize)); + + SourceModifiedAccessConditions modifiedAccessConditions = new SourceModifiedAccessConditions() + .sourceIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + Context context = new Context("key", "value"); + + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlockFromUrlWithResponse(sourceUrl, new BlobRange(offset, count), null, + appendBlobAccessConditions, modifiedAccessConditions, timeout, context).value().blobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context + } +}