Class AppendBlobAsyncClient
- java.lang.Object
-
- com.azure.storage.blob.specialized.BlobAsyncClientBase
-
- com.azure.storage.blob.specialized.AppendBlobAsyncClient
-
public final class AppendBlobAsyncClient extends BlobAsyncClientBase
Client to an append blob. It may only be instantiated through aSpecializedBlobClientBuilder.buildAppendBlobAsyncClient()or via the methodBlobAsyncClient.getAppendBlobAsyncClient(). 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.This client contains operations on a blob. Operations on a container are available on
BlobContainerAsyncClient, and operations on the service are available onBlobServiceAsyncClient.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 aCompletableFutureobject throughMono.toFuture().
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_APPEND_BLOCK_BYTESIndicates the maximum number of bytes that can be sent in a call to appendBlock.static intMAX_BLOCKSIndicates the maximum number of blocks allowed in an append blob.-
Fields inherited from class com.azure.storage.blob.specialized.BlobAsyncClientBase
accountName, azureBlobStorage, blobName, containerName, encryptionScope, serviceVersion
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<AppendBlobItem>appendBlock(Flux<ByteBuffer> data, long length)Commits a new block of data to the end of the existing append blob.Mono<AppendBlobItem>appendBlockFromUrl(String sourceUrl, BlobRange sourceRange)Commits a new block of data from another blob to the end of this append blob.Mono<com.azure.core.http.rest.Response<AppendBlobItem>>appendBlockFromUrlWithResponse(AppendBlobAppendBlockFromUrlOptions options)Commits a new block of data from another blob to the end of this append blob.Mono<com.azure.core.http.rest.Response<AppendBlobItem>>appendBlockFromUrlWithResponse(String sourceUrl, BlobRange sourceRange, byte[] sourceContentMD5, AppendBlobRequestConditions destRequestConditions, BlobRequestConditions sourceRequestConditions)Commits a new block of data from another blob to the end of this append blob.Mono<com.azure.core.http.rest.Response<AppendBlobItem>>appendBlockWithResponse(Flux<ByteBuffer> data, long length, byte[] contentMd5, AppendBlobRequestConditions appendBlobRequestConditions)Commits a new block of data to the end of the existing append blob.Mono<AppendBlobItem>create()Creates a 0-length append blob.Mono<AppendBlobItem>create(boolean overwrite)Creates a 0-length append blob.Mono<com.azure.core.http.rest.Response<AppendBlobItem>>createWithResponse(BlobHttpHeaders headers, Map<String,String> metadata, BlobRequestConditions requestConditions)Creates a 0-length append blob.Mono<com.azure.core.http.rest.Response<AppendBlobItem>>createWithResponse(AppendBlobCreateOptions options)Creates a 0-length append blob.AppendBlobAsyncClientgetCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey)Creates a newAppendBlobAsyncClientwith the specifiedcustomerProvidedKey.AppendBlobAsyncClientgetEncryptionScopeAsyncClient(String encryptionScope)Creates a newAppendBlobAsyncClientwith the specifiedencryptionScope.Mono<Void>seal()Seals an append blob, making it read only.Mono<com.azure.core.http.rest.Response<Void>>sealWithResponse(AppendBlobSealOptions options)Seals an append blob, making it read only.-
Methods inherited from class com.azure.storage.blob.specialized.BlobAsyncClientBase
abortCopyFromUrl, abortCopyFromUrlWithResponse, beginCopy, beginCopy, beginCopy, copyFromUrl, copyFromUrlWithResponse, copyFromUrlWithResponse, createSnapshot, createSnapshotWithResponse, delete, 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, getContainerAsyncClient, getContainerName, getCustomerProvidedKey, getEncryptionScope, getHttpPipeline, getProperties, getPropertiesWithResponse, getServiceVersion, getSnapshotClient, getSnapshotId, getTags, getTagsWithResponse, getVersionClient, getVersionId, isSnapshot, query, queryWithResponse, setAccessTier, setAccessTierWithResponse, setAccessTierWithResponse, setHttpHeaders, setHttpHeadersWithResponse, setImmutabilityPolicy, setImmutabilityPolicyWithResponse, setLegalHold, setLegalHoldWithResponse, setMetadata, setMetadataWithResponse, setTags, setTagsWithResponse, undelete, undeleteWithResponse
-
-
-
-
Field Detail
-
MAX_APPEND_BLOCK_BYTES
public static final int MAX_APPEND_BLOCK_BYTES
Indicates the maximum number of bytes that can be sent in a call to appendBlock.- See Also:
- Constant Field Values
-
MAX_BLOCKS
public static final int MAX_BLOCKS
Indicates the maximum number of blocks allowed in an append blob.- See Also:
- Constant Field Values
-
-
Method Detail
-
getEncryptionScopeAsyncClient
public AppendBlobAsyncClient getEncryptionScopeAsyncClient(String encryptionScope)
Creates a newAppendBlobAsyncClientwith the specifiedencryptionScope.- Overrides:
getEncryptionScopeAsyncClientin classBlobAsyncClientBase- Parameters:
encryptionScope- the encryption scope for the blob, passnullto use no encryption scope.- Returns:
- a
AppendBlobAsyncClientwith the specifiedencryptionScope.
-
getCustomerProvidedKeyAsyncClient
public AppendBlobAsyncClient getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey)
Creates a newAppendBlobAsyncClientwith the specifiedcustomerProvidedKey.- Overrides:
getCustomerProvidedKeyAsyncClientin classBlobAsyncClientBase- Parameters:
customerProvidedKey- theCustomerProvidedKeyfor the blob, passnullto use no customer provided key.- Returns:
- a
AppendBlobAsyncClientwith the specifiedcustomerProvidedKey.
-
create
public Mono<AppendBlobItem> create()
Creates a 0-length append blob. Call appendBlock to append data to an append blob. By default this method will not overwrite an existing blob.Code Samples
client.create().subscribe(response -> System.out.printf("Created AppendBlob at %s%n", response.getLastModified()));- Returns:
- A
Monocontaining the information of the created appended blob.
-
create
public Mono<AppendBlobItem> create(boolean overwrite)
Creates a 0-length append blob. Call appendBlock to append data to an append blob.Code Samples
boolean overwrite = false; // Default behavior client.create(overwrite).subscribe(response -> System.out.printf("Created AppendBlob at %s%n", response.getLastModified()));- Parameters:
overwrite- Whether to overwrite, should data exist on the blob.- Returns:
- A
Monocontaining the information of the created appended blob.
-
createWithResponse
public Mono<com.azure.core.http.rest.Response<AppendBlobItem>> createWithResponse(BlobHttpHeaders headers, Map<String,String> metadata, BlobRequestConditions requestConditions)
Creates a 0-length append blob. Call appendBlock to append data to an append blob.To avoid overwriting, pass "*" to
BlobRequestConditions.setIfNoneMatch(String).Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentType("binary") .setContentLanguage("en-US"); Map<String, String> metadata = Collections.singletonMap("metadata", "value"); BlobRequestConditions requestConditions = new BlobRequestConditions().setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); client.createWithResponse(headers, metadata, requestConditions).subscribe(response -> System.out.printf("Created AppendBlob at %s%n", response.getValue().getLastModified()));- Parameters:
headers-BlobHttpHeadersmetadata- 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
MonocontainingResponsewhosevaluecontains the created appended blob.
-
createWithResponse
public Mono<com.azure.core.http.rest.Response<AppendBlobItem>> createWithResponse(AppendBlobCreateOptions options)
Creates a 0-length append blob. Call appendBlock to append data to an append blob.To avoid overwriting, pass "*" to
BlobRequestConditions.setIfNoneMatch(String).Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentType("binary") .setContentLanguage("en-US"); Map<String, String> metadata = Collections.singletonMap("metadata", "value"); Map<String, String> tags = Collections.singletonMap("tag", "value"); BlobRequestConditions requestConditions = new BlobRequestConditions().setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); client.createWithResponse(new AppendBlobCreateOptions().setHeaders(headers).setMetadata(metadata) .setTags(tags).setRequestConditions(requestConditions)).subscribe(response -> System.out.printf("Created AppendBlob at %s%n", response.getValue().getLastModified()));- Parameters:
options-AppendBlobCreateOptions- Returns:
- A
MonocontainingResponsewhosevaluecontains the created appended blob.
-
appendBlock
public Mono<AppendBlobItem> appendBlock(Flux<ByteBuffer> data, long length)
Commits a new block of data to the end of the existing append blob.Note that the data passed must be replayable if retries are enabled (the default). In other words, the
Fluxmust produce the same data each time it is subscribed to.Code Samples
client.appendBlock(data, length).subscribe(response -> System.out.printf("AppendBlob has %d committed blocks%n", response.getBlobCommittedBlockCount()));- Parameters:
data- The data to write to the blob. Note that thisFluxmust be replayable if retries are enabled (the default). In other words, the Flux must produce the same data each time it is subscribed to.length- The exact length of the data. It is important that this value match precisely the length of the data emitted by theFlux.- Returns:
Monocontaining the information of the append blob operation.
-
appendBlockWithResponse
public Mono<com.azure.core.http.rest.Response<AppendBlobItem>> appendBlockWithResponse(Flux<ByteBuffer> data, long length, byte[] contentMd5, AppendBlobRequestConditions appendBlobRequestConditions)
Commits a new block of data to the end of the existing append blob.Note that the data passed must be replayable if retries are enabled (the default). In other words, the
Fluxmust produce the same data each time it is subscribed to.Code Samples
byte[] md5 = MessageDigest.getInstance("MD5").digest("data".getBytes(StandardCharsets.UTF_8)); AppendBlobRequestConditions requestConditions = new AppendBlobRequestConditions() .setAppendPosition(POSITION) .setMaxSize(maxSize); client.appendBlockWithResponse(data, length, md5, requestConditions).subscribe(response -> System.out.printf("AppendBlob has %d committed blocks%n", response.getValue().getBlobCommittedBlockCount()));- Parameters:
data- The data to write to the blob. Note that thisFluxmust be replayable if retries are enabled (the default). In other words, the Flux must produce the same data each time it is subscribed to.length- The exact length of the data. It is important that this value match precisely the length of the data emitted by theFlux.contentMd5- An MD5 hash of the block content. This hash is used to verify the integrity of the block 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.appendBlobRequestConditions-AppendBlobRequestConditions- Returns:
- A
MonocontainingResponsewhosevaluecontains the append blob operation.
-
appendBlockFromUrl
public Mono<AppendBlobItem> appendBlockFromUrl(String sourceUrl, BlobRange sourceRange)
Commits a new block of data from another blob to the end of this append blob.Code Samples
client.appendBlockFromUrl(sourceUrl, new BlobRange(offset, count)).subscribe(response -> System.out.printf("AppendBlob has %d committed blocks%n", response.getBlobCommittedBlockCount()));- Parameters:
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.sourceRange- The sourceBlobRangeto copy.- Returns:
Monocontaining the information of the append blob operation.
-
appendBlockFromUrlWithResponse
public Mono<com.azure.core.http.rest.Response<AppendBlobItem>> appendBlockFromUrlWithResponse(String sourceUrl, BlobRange sourceRange, byte[] sourceContentMD5, AppendBlobRequestConditions destRequestConditions, BlobRequestConditions sourceRequestConditions)
Commits a new block of data from another blob to the end of this append blob.Code Samples
AppendBlobRequestConditions appendBlobRequestConditions = new AppendBlobRequestConditions() .setAppendPosition(POSITION) .setMaxSize(maxSize); BlobRequestConditions modifiedRequestConditions = new BlobRequestConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); client.appendBlockFromUrlWithResponse(sourceUrl, new BlobRange(offset, count), null, appendBlobRequestConditions, modifiedRequestConditions).subscribe(response -> System.out.printf("AppendBlob has %d committed blocks%n", response.getValue().getBlobCommittedBlockCount()));- Parameters:
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.sourceRange-BlobRangesourceContentMD5- 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-AppendBlobRequestConditionssourceRequestConditions-BlobRequestConditions- Returns:
- A
MonocontainingResponsewhosevaluecontains the append blob operation.
-
appendBlockFromUrlWithResponse
public Mono<com.azure.core.http.rest.Response<AppendBlobItem>> appendBlockFromUrlWithResponse(AppendBlobAppendBlockFromUrlOptions options)
Commits a new block of data from another blob to the end of this append blob.Code Samples
AppendBlobRequestConditions appendBlobRequestConditions = new AppendBlobRequestConditions() .setAppendPosition(POSITION) .setMaxSize(maxSize); BlobRequestConditions modifiedRequestConditions = new BlobRequestConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); client.appendBlockFromUrlWithResponse(new AppendBlobAppendBlockFromUrlOptions(sourceUrl) .setSourceRange(new BlobRange(offset, count)) .setDestinationRequestConditions(appendBlobRequestConditions) .setSourceRequestConditions(modifiedRequestConditions)).subscribe(response -> System.out.printf("AppendBlob has %d committed blocks%n", response.getValue().getBlobCommittedBlockCount()));- Parameters:
options- Parameters for the operation.- Returns:
- A
MonocontainingResponsewhosevaluecontains the append blob operation.
-
seal
public Mono<Void> seal()
Seals an append blob, making it read only. Any subsequent appends will fail.Code Samples
client.seal().subscribe(response -> System.out.println("Sealed AppendBlob"));- Returns:
- A reactive response signalling completion.
-
sealWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> sealWithResponse(AppendBlobSealOptions options)
Seals an append blob, making it read only. Any subsequent appends will fail.Code Samples
AppendBlobRequestConditions requestConditions = new AppendBlobRequestConditions().setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); client.sealWithResponse(new AppendBlobSealOptions().setRequestConditions(requestConditions)) .subscribe(response -> System.out.println("Sealed AppendBlob"));- Parameters:
options-AppendBlobSealOptions- Returns:
- A reactive response signalling completion.
-
-