public final class AppendBlobAsyncClient extends BlobAsyncClientBase
SpecializedBlobClientBuilder.buildAppendBlobAsyncClient()
or via the method
BlobAsyncClient.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 on BlobServiceAsyncClient
.
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()
.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_APPEND_BLOCK_BYTES
Indicates the maximum number of bytes that can be sent in a call to appendBlock.
|
static int |
MAX_BLOCKS
Indicates the maximum number of blocks allowed in an append blob.
|
accountName, azureBlobStorage, blobName, containerName, serviceVersion
Modifier and Type | Method and 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<Response<AppendBlobItem>> |
appendBlockFromUrlWithResponse(String sourceUrl,
BlobRange sourceRange,
byte[] sourceContentMD5,
AppendBlobRequestConditions destAccessConditions,
BlobRequestConditions sourceAccessConditions)
Commits a new block of data from another blob to the end of this append blob.
|
Mono<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<Response<AppendBlobItem>> |
createWithResponse(BlobHttpHeaders headers,
Map<String,String> metadata,
BlobRequestConditions accessConditions)
Creates a 0-length append blob.
|
abortCopyFromUrl, abortCopyFromUrlWithResponse, beginCopy, beginCopy, copyFromUrl, copyFromUrlWithResponse, createSnapshot, createSnapshotWithResponse, delete, deleteWithResponse, download, downloadToFile, downloadToFileWithResponse, downloadWithResponse, exists, existsWithResponse, getAccountInfo, getAccountInfoWithResponse, getAccountName, getBlobName, getBlobUrl, getContainerName, getCustomerProvidedKey, getHttpPipeline, getProperties, getPropertiesWithResponse, getServiceVersion, getSnapshotClient, getSnapshotId, isSnapshot, setAccessTier, setAccessTierWithResponse, setHttpHeaders, setHttpHeadersWithResponse, setMetadata, setMetadataWithResponse, undelete, undeleteWithResponse
public static final int MAX_APPEND_BLOCK_BYTES
public static final int MAX_BLOCKS
public Mono<AppendBlobItem> create()
Code Samples
client.create().subscribe(response ->
System
.out.printf("Created AppendBlob at %s%n", response.getLastModified()));
Mono
containing the information of the created appended blob.public Mono<AppendBlobItem> create(boolean overwrite)
Code Samples
boolean overwrite = false; // Default behavior
client.create(overwrite).subscribe(response ->
System
.out.printf("Created AppendBlob at %s%n", response.getLastModified()));
overwrite
- Whether or not to overwrite, should data exist on the blob.Mono
containing the information of the created appended blob.public Mono<Response<AppendBlobItem>> createWithResponse(BlobHttpHeaders headers, Map<String,String> metadata, BlobRequestConditions accessConditions)
Code Samples
BlobHttpHeaders
headers = newBlobHttpHeaders
() .setContentType("binary") .setContentLanguage("en-US");Map
<String
,String
> metadata =Collections
.singletonMap("metadata", "value");BlobRequestConditions
accessConditions = newBlobRequestConditions
().setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime
.now().minusDays(3)); client.createWithResponse(headers, metadata, accessConditions).subscribe(response ->System
.out.printf("Created AppendBlob at %s%n", response.getValue().getLastModified()));
headers
- BlobHttpHeaders
metadata
- Metadata to associate with the blob.accessConditions
- BlobRequestConditions
Mono
containing Response
whose value
contains the created
appended blob.public Mono<AppendBlobItem> appendBlock(Flux<ByteBuffer> data, long length)
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
client.appendBlock(data, length).subscribe(response ->
System
.out.printf("AppendBlob has %d committed blocks%n", response.getBlobCommittedBlockCount()));
data
- The data to write to the blob. Note that this 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.length
- The exact length of the data. It is important that this value match precisely the length of the
data emitted by the Flux
.Mono
containing the information of the append blob operation.public Mono<Response<AppendBlobItem>> appendBlockWithResponse(Flux<ByteBuffer> data, long length, byte[] contentMd5, AppendBlobRequestConditions appendBlobRequestConditions)
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));AppendBlobRequestConditions
accessConditions = newAppendBlobRequestConditions
() .setAppendPosition(POSITION) .setMaxSize(maxSize); client.appendBlockWithResponse(data, length, md5, accessConditions).subscribe(response ->System
.out.printf("AppendBlob has %d committed blocks%n", response.getValue().getBlobCommittedBlockCount()));
data
- The data to write to the blob. Note that this 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.length
- The exact length of the data. It is important that this value match precisely the length of the
data emitted by the Flux
.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
Mono
containing Response
whose value
contains the append
blob operation.public Mono<AppendBlobItem> appendBlockFromUrl(String sourceUrl, BlobRange sourceRange)
Code Samples
client.appendBlockFromUrl(sourceUrl, newBlobRange
(offset, count)).subscribe(response ->System
.out.printf("AppendBlob has %d committed blocks%n", response.getBlobCommittedBlockCount()));
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 source BlobRange
to copy.Mono
containing the information of the append blob operation.public Mono<Response<AppendBlobItem>> appendBlockFromUrlWithResponse(String sourceUrl, BlobRange sourceRange, byte[] sourceContentMD5, AppendBlobRequestConditions destAccessConditions, BlobRequestConditions sourceAccessConditions)
Code Samples
AppendBlobRequestConditions
appendBlobRequestConditions = newAppendBlobRequestConditions
() .setAppendPosition(POSITION) .setMaxSize(maxSize);BlobRequestConditions
modifiedAccessConditions = newBlobRequestConditions
() .setIfUnmodifiedSince(OffsetDateTime
.now().minusDays(3)); client.appendBlockFromUrlWithResponse(sourceUrl, newBlobRange
(offset, count), null, appendBlobRequestConditions, modifiedAccessConditions).subscribe(response ->System
.out.printf("AppendBlob has %d committed blocks%n", response.getValue().getBlobCommittedBlockCount()));
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
- BlobRange
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.destAccessConditions
- AppendBlobRequestConditions
sourceAccessConditions
- BlobRequestConditions
Mono
containing Response
whose value
contains the append
blob operation.Copyright © 2019 Microsoft Corporation. All rights reserved.