Share via


AppendBlobClient クラス

public final class AppendBlobClient
extends BlobClientBase

追加 BLOB へのクライアント。 インスタンス化できるのは、 メソッド getAppendBlobClient()または を介SpecializedBlobClientBuilderしてのみです。 このクラスは特定の BLOB に関する状態を保持しませんが、代わりにサービス上のリソースに適切な要求を送信する便利な方法です。

このクライアントには、BLOB に対する操作が含まれています。 コンテナーに対する操作は で BlobContainerClient使用でき、サービスに対する操作は で BlobServiceClient使用できます。

詳細については、 Azure Docs を参照してください。

フィールドの概要

修飾子と型 フィールドと説明
static final int MAX_APPEND_BLOCK_BYTES

非推奨

を使用します getMaxAppendBlockBytes()

Block を追加する呼び出しで送信できる最大バイト数を示します

static final int MAX_BLOCKS

非推奨

を使用します getMaxBlocks()

追加 BLOB で許可されるブロックの最大数を示します。

メソッドの概要

修飾子と型 メソッドと説明
AppendBlobItem appendBlock(InputStream data, long length)

既存の追加 BLOB の末尾に新しいデータ ブロックをコミットします。

AppendBlobItem appendBlockFromUrl(String sourceUrl, BlobRange sourceRange)

別の BLOB からこの追加 BLOB の末尾に新しいデータ ブロックをコミットします。

Response<AppendBlobItem> appendBlockFromUrlWithResponse(AppendBlobAppendBlockFromUrlOptions options, Duration timeout, Context context)

別の BLOB からこの追加 BLOB の末尾に新しいデータ ブロックをコミットします。

Response<AppendBlobItem> appendBlockFromUrlWithResponse(String sourceUrl, BlobRange sourceRange, byte[] sourceContentMd5, AppendBlobRequestConditions destRequestConditions, BlobRequestConditions sourceRequestConditions, Duration timeout, Context context)

別の BLOB からこの追加 BLOB の末尾に新しいデータ ブロックをコミットします。

Response<AppendBlobItem> appendBlockWithResponse(InputStream data, long length, byte[] contentMd5, AppendBlobRequestConditions appendBlobRequestConditions, Duration timeout, Context context)

新しいデータ ブロックを既存の追加 BLOB の末尾にコミットします。

AppendBlobItem create()

0 長の追加 BLOB を作成します。

AppendBlobItem create(boolean overwrite)

0 長の追加 BLOB を作成します。

AppendBlobItem createIfNotExists()

存在しない場合は、0 長の追加 BLOB を作成します。

Response<AppendBlobItem> createIfNotExistsWithResponse(AppendBlobCreateOptions options, Duration timeout, Context context)

存在しない場合は、0 長の追加 BLOB を作成します。

Response<AppendBlobItem> createWithResponse(BlobHttpHeaders headers, Map<String,String> metadata, BlobRequestConditions requestConditions, Duration timeout, Context context)

0 長の追加 BLOB を作成します。

Response<AppendBlobItem> createWithResponse(AppendBlobCreateOptions options, Duration timeout, Context context)

0 長の追加 BLOB を作成します。

BlobOutputStream getBlobOutputStream()

出力ストリームを作成して開き、追加 BLOB にデータを書き込みます。

BlobOutputStream getBlobOutputStream(boolean overwrite)

出力ストリームを作成して開き、追加 BLOB にデータを書き込みます。

BlobOutputStream getBlobOutputStream(AppendBlobRequestConditions requestConditions)

出力ストリームを作成して開き、追加 BLOB にデータを書き込みます。

AppendBlobClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey)

指定した AppendBlobClient を使用して、新しい customerProvidedKey を作成します。

AppendBlobClient getEncryptionScopeClient(String encryptionScope)

指定した AppendBlobClient を使用して、新しい encryptionScope を作成します。

int getMaxAppendBlockBytes()

使用されているサービス バージョンに基づいて、追加ブロックバイトの最大数を取得します。

int getMaxBlocks()

追加 BLOB で許可されるブロックの最大数を取得します。

void seal()

追加 BLOB をシールし、読み取り専用にします。

Response<Void> sealWithResponse(AppendBlobSealOptions options, Duration timeout, Context context)

追加 BLOB をシールし、読み取り専用にします。

メソッドの継承元: BlobClientBase

abortCopyFromUrl abortCopyFromUrlWithResponse beginCopy beginCopy beginCopy copyFromUrl copyFromUrlWithResponse copyFromUrlWithResponse createSnapshot createSnapshotWithResponse delete deleteIfExists deleteIfExistsWithResponse deleteImmutabilityPolicy deleteImmutabilityPolicyWithResponse deleteWithResponse download downloadContent downloadContentWithResponse downloadContentWithResponse downloadStream downloadStreamWithResponse downloadToFile downloadToFile downloadToFileWithResponse downloadToFileWithResponse downloadToFileWithResponse downloadWithResponse exists existsWithResponse generateSas generateSas generateUserDelegationSas generateUserDelegationSas getAccountInfo getAccountInfoWithResponse getAccountName getAccountUrl getBlobName getBlobUrl getContainerClient getContainerName getCustomerProvidedKey getCustomerProvidedKeyClient getEncryptionScope getEncryptionScopeClient getHttpPipeline getProperties getPropertiesWithResponse getServiceVersion getSnapshotClient getSnapshotId getTags getTagsWithResponse getVersionClient getVersionId isSnapshot openInputStream openInputStream openInputStream openInputStream openQueryInputStream openQueryInputStreamWithResponse openSeekableByteChannelRead query queryWithResponse setAccessTier setAccessTierWithResponse setAccessTierWithResponse setHttpHeaders setHttpHeadersWithResponse setImmutabilityPolicy setImmutabilityPolicyWithResponse setLegalHold setLegalHoldWithResponse setMetadata setMetadataWithResponse setTags setTagsWithResponse undelete undeleteWithResponse

メソッドの継承元: java.lang.Object

フィールドの詳細

MAX_APPEND_BLOCK_BYTES

@Deprecated
public static final int MAX_APPEND_BLOCK_BYTES

非推奨

を使用します getMaxAppendBlockBytes()

appendBlock の呼び出しで送信できる最大バイト数を示します。

MAX_BLOCKS

@Deprecated
public static final int MAX_BLOCKS

非推奨

を使用します getMaxBlocks()

追加 BLOB で許可されるブロックの最大数を示します。

メソッドの詳細

appendBlock

public AppendBlobItem appendBlock(InputStream data, long length)

既存の追加 BLOB の末尾に新しいデータ ブロックをコミットします。

再試行が有効になっている場合 (既定値) は、渡されたデータを再生可能にする必要があることに注意してください。 つまり、 Flux はサブスクライブされるたびに同じデータを生成する必要があります。 サービス バージョン 2022-11-02 以降の場合、最大ブロック サイズは 100 MB です。 以前のバージョンでは、最大ブロック サイズは 4 MB です。 詳細については、 Azure Docs に関するページを参照してください。

コード サンプル

System.out.printf("AppendBlob has %d committed blocks%n",
     client.appendBlock(data, length).getBlobCommittedBlockCount());

Parameters:

data - BLOB に書き込むデータ。 データはマーク可能である必要があります。 これは再試行をサポートするためです。 データがマーク可能でない場合は、 を使用 getBlobOutputStream() して、返される OutputStream に書き込むかどうかを検討してください。 または、データ ソースを BufferedInputStream にラップしてマーク サポートを追加することを検討してください。
length - データの正確な長さ。 この値は、 によって Flux出力されるデータの長さと正確に一致することが重要です。

Returns:

追加 BLOB 操作の情報。

appendBlockFromUrl

public AppendBlobItem appendBlockFromUrl(String sourceUrl, BlobRange sourceRange)

別の BLOB からこの追加 BLOB の末尾に新しいデータ ブロックをコミットします。

コード サンプル

System.out.printf("AppendBlob has %d committed blocks%n",
     client.appendBlockFromUrl(sourceUrl, new BlobRange(offset, count)).getBlobCommittedBlockCount());

Parameters:

sourceUrl - コピーのソースとなる BLOB の URL。 同じストレージ アカウント内のソース BLOB は、共有キーを使用して認証できます。 ただし、ソースが別のアカウントの BLOB の場合、ソース BLOB はパブリックであるか、共有アクセス署名を介して認証される必要があります。 ソース BLOB がパブリックの場合、操作を実行するために認証は必要ありません。
sourceRange - コピーするソース BlobRange

Returns:

追加 BLOB 操作の情報。

appendBlockFromUrlWithResponse

public Response appendBlockFromUrlWithResponse(AppendBlobAppendBlockFromUrlOptions options, Duration timeout, Context context)

別の BLOB からこの追加 BLOB の末尾に新しいデータ ブロックをコミットします。

コード サンプル

AppendBlobRequestConditions appendBlobRequestConditions = new AppendBlobRequestConditions()
     .setAppendPosition(POSITION)
     .setMaxSize(maxSize);

 BlobRequestConditions modifiedRequestConditions = new BlobRequestConditions()
     .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));

 Context context = new Context("key", "value");

 System.out.printf("AppendBlob has %d committed blocks%n",
     client.appendBlockFromUrlWithResponse(new AppendBlobAppendBlockFromUrlOptions(sourceUrl)
         .setSourceRange(new BlobRange(offset, count))
         .setDestinationRequestConditions(appendBlobRequestConditions)
         .setSourceRequestConditions(modifiedRequestConditions), timeout,
         context).getValue().getBlobCommittedBlockCount());

Parameters:

options - 操作のオプション
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

追加 BLOB 操作の情報。

appendBlockFromUrlWithResponse

public Response appendBlockFromUrlWithResponse(String sourceUrl, BlobRange sourceRange, byte[] sourceContentMd5, AppendBlobRequestConditions destRequestConditions, BlobRequestConditions sourceRequestConditions, Duration timeout, Context context)

別の BLOB からこの追加 BLOB の末尾に新しいデータ ブロックをコミットします。

コード サンプル

AppendBlobRequestConditions appendBlobRequestConditions = new AppendBlobRequestConditions()
     .setAppendPosition(POSITION)
     .setMaxSize(maxSize);

 BlobRequestConditions modifiedRequestConditions = new BlobRequestConditions()
     .setIfUnmodifiedSince(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,
         appendBlobRequestConditions, modifiedRequestConditions, timeout,
         context).getValue().getBlobCommittedBlockCount());

Parameters:

sourceUrl - コピーのソースとなる BLOB の URL。 同じストレージ アカウント内のソース BLOB は、共有キーを使用して認証できます。 ただし、ソースが別のアカウントの BLOB の場合、ソース BLOB はパブリックであるか、共有アクセス署名を介して認証される必要があります。 ソース BLOB がパブリックの場合、操作を実行するために認証は必要ありません。
sourceRange - BlobRange
sourceContentMd5 - ソース BLOB からのブロック コンテンツの MD5 ハッシュ。 指定した場合、サービスは受信したデータの MD5 を計算し、指定された MD5 と一致しない場合は要求を失敗させます。
destRequestConditions - AppendBlobRequestConditions
sourceRequestConditions - BlobRequestConditions
timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

追加 BLOB 操作の情報。

appendBlockWithResponse

public Response appendBlockWithResponse(InputStream data, long length, byte[] contentMd5, AppendBlobRequestConditions appendBlobRequestConditions, Duration timeout, Context context)

新しいデータ ブロックを既存の追加 BLOB の末尾にコミットします。

再試行が有効になっている場合 (既定値) は、渡されたデータを再生可能にする必要があることに注意してください。 つまり、 は Flux サブスクライブされるたびに同じデータを生成する必要があります。 サービス バージョン 2022-11-02 以降の場合、最大ブロック サイズは 100 MB です。 以前のバージョンでは、最大ブロック サイズは 4 MB です。 詳細については、 Azure Docs に関するページを参照してください。

コード サンプル

byte[] md5 = MessageDigest.getInstance("MD5").digest("data".getBytes(StandardCharsets.UTF_8));
 AppendBlobRequestConditions requestConditions = new AppendBlobRequestConditions()
     .setAppendPosition(POSITION)
     .setMaxSize(maxSize);
 Context context = new Context("key", "value");

 System.out.printf("AppendBlob has %d committed blocks%n",
     client.appendBlockWithResponse(data, length, md5, requestConditions, timeout, context)
         .getValue().getBlobCommittedBlockCount());

Parameters:

data - BLOB に書き込むデータ。 データはマーク可能である必要があります。 これは、再試行をサポートするためです。 データがマーク可能でない場合は、 を使用 getBlobOutputStream() して、返された OutputStream に書き込む方法を検討してください。 または、データ ソースを BufferedInputStream にラップして、マークのサポートを追加することを検討してください。
length - データの正確な長さ。 この値は、 によって Flux出力されるデータの長さと正確に一致することが重要です。
contentMd5 - ブロックのコンテンツの MD5 ハッシュ。 このハッシュは、転送時のブロックの整合性を確認するために使用します。 このヘッダーを指定すると、ストレージ サービスによって、到達したコンテンツのハッシュと、このヘッダー値が比較されます。 この MD5 ハッシュは BLOB と共に保存されません。 2 つのハッシュが一致しない場合、操作は失敗します。
appendBlobRequestConditions - AppendBlobRequestConditions
timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

Response<T>value追加 BLOB 操作を含む 。

create

public AppendBlobItem create()

0 長の追加 BLOB を作成します。 appendBlock を呼び出して、追加 BLOB にデータを追加します。 既定では、このメソッドは既存の BLOB を上書きしません。

コード サンプル

System.out.printf("Created AppendBlob at %s%n", client.create().getLastModified());

Returns:

作成された追加された BLOB の情報。

create

public AppendBlobItem create(boolean overwrite)

0 長の追加 BLOB を作成します。 appendBlock を呼び出して、追加 BLOB にデータを追加します。

コード サンプル

boolean overwrite = false; // Default value
 System.out.printf("Created AppendBlob at %s%n", client.create(overwrite).getLastModified());

Parameters:

overwrite - 上書きするかどうかに関係なく、BLOB にデータが存在する必要があります。

Returns:

作成された追加された BLOB の情報。

createIfNotExists

public AppendBlobItem createIfNotExists()

存在しない場合は、0 長の追加 BLOB を作成します。 appendBlock を呼び出して、追加 BLOB にデータを追加します。

コード サンプル

client.createIfNotExists();
 System.out.println("Created AppendBlob");

Returns:

AppendBlobItem 作成された追加 BLOB の情報を格納しています。

createIfNotExistsWithResponse

public Response createIfNotExistsWithResponse(AppendBlobCreateOptions options, Duration timeout, Context context)

存在しない場合は、0 長の追加 BLOB を作成します。 appendBlock を呼び出して、追加 BLOB にデータを追加します。

コード サンプル

BlobHttpHeaders headers = new BlobHttpHeaders()
     .setContentType("binary")
     .setContentLanguage("en-US");
 Map<String, String> metadata = Collections.singletonMap("metadata", "value");
 Map<String, String> tags = Collections.singletonMap("tags", "value");
 Context context = new Context("key", "value");

 Response<AppendBlobItem> response = client.createIfNotExistsWithResponse(new AppendBlobCreateOptions()
     .setHeaders(headers).setMetadata(metadata).setTags(tags), timeout, context);
 if (response.getStatusCode() == 409) {
     System.out.println("Already existed.");
 } else {
     System.out.printf("Create completed with status %d%n", response.getStatusCode());
 }

Parameters:

timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

事後対応応答 Response<T> シグナル入力候補。 には、 value 追加 BLOB に AppendBlobItem 関する情報を含む が含まれます。 の状態コードが 201 の場合 Response<T>、新しい追加 BLOB が正常に作成されました。 状態コードが 409 の場合は、この場所に追加 BLOB が既に存在します。

createWithResponse

public Response createWithResponse(BlobHttpHeaders headers, Map metadata, BlobRequestConditions requestConditions, Duration timeout, Context context)

0 長の追加 BLOB を作成します。 appendBlock を呼び出して、追加 BLOB にデータを追加します。

上書きを回避するには、"*" を に setIfNoneMatch(String ifNoneMatch)渡します。

コード サンプル

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));
 Context context = new Context("key", "value");

 System.out.printf("Created AppendBlob at %s%n",
     client.createWithResponse(headers, metadata, requestConditions, timeout, context).getValue()
         .getLastModified());

Parameters:

headers - BlobHttpHeaders
metadata - BLOB に関連付けるメタデータ。 メタデータ キーまたは値に先頭または末尾の空白がある場合は、削除またはエンコードする必要があります。
requestConditions - BlobRequestConditions
timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

Response<T>value作成された追加された BLOB を含む 。

createWithResponse

public Response createWithResponse(AppendBlobCreateOptions options, Duration timeout, Context context)

0 長の追加 BLOB を作成します。 appendBlock を呼び出して、追加 BLOB にデータを追加します。

上書きを回避するには、"*" を に setIfNoneMatch(String ifNoneMatch)渡します。

コード サンプル

BlobHttpHeaders headers = new BlobHttpHeaders()
     .setContentType("binary")
     .setContentLanguage("en-US");
 Map<String, String> metadata = Collections.singletonMap("metadata", "value");
 Map<String, String> tags = Collections.singletonMap("tags", "value");
 BlobRequestConditions requestConditions = new BlobRequestConditions()
     .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
 Context context = new Context("key", "value");

 System.out.printf("Created AppendBlob at %s%n",
     client.createWithResponse(new AppendBlobCreateOptions().setHeaders(headers).setMetadata(metadata)
         .setTags(tags).setRequestConditions(requestConditions), timeout, context).getValue()
         .getLastModified());

Parameters:

timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

Response<T>value作成された追加された BLOB を含む 。

getBlobOutputStream

public BlobOutputStream getBlobOutputStream()

出力ストリームを作成して開き、追加 BLOB にデータを書き込みます。 サービスに BLOB が既に存在する場合は、新しいデータが既存の BLOB に追加されます。

Returns:

BlobOutputStream BLOB にデータを書き込む際に使用される オブジェクト。

getBlobOutputStream

public BlobOutputStream getBlobOutputStream(boolean overwrite)

出力ストリームを作成して開き、追加 BLOB にデータを書き込みます。 overwrite を指定すると true、既存の BLOB が削除され、再作成されます。BLOB にデータが存在する必要があります。 overwrite を指定すると false、新しいデータが既存の BLOB に追加されます。

Parameters:

overwrite - 既存の BLOB を削除して再作成するかどうかは、BLOB にデータが存在する必要があります。

Returns:

BlobOutputStream BLOB にデータを書き込む際に使用される オブジェクト。

getBlobOutputStream

public BlobOutputStream getBlobOutputStream(AppendBlobRequestConditions requestConditions)

出力ストリームを作成して開き、追加 BLOB にデータを書き込みます。

Parameters:

requestConditions - BlobRequestConditions BLOB のアクセス条件を表す オブジェクト。

Returns:

BlobOutputStream BLOB にデータを書き込む際に使用される オブジェクト。

getCustomerProvidedKeyClient

public AppendBlobClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey)

指定した AppendBlobClient を使用して、新しい customerProvidedKey を作成します。

Overrides:

AppendBlobClient.getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey)

Parameters:

customerProvidedKey - BLOB の には CustomerProvidedKey 、 を渡 null して、顧客が指定したキーを使用しません。

Returns:

指定 AppendBlobClient した customerProvidedKeyを持つ 。

getEncryptionScopeClient

public AppendBlobClient getEncryptionScopeClient(String encryptionScope)

指定した AppendBlobClient を使用して、新しい encryptionScope を作成します。

Overrides:

AppendBlobClient.getEncryptionScopeClient(String encryptionScope)

Parameters:

encryptionScope - BLOB の暗号化スコープ。 を渡 null して暗号化スコープを使用しません。

Returns:

指定 AppendBlobClient した encryptionScopeを持つ 。

getMaxAppendBlockBytes

public int getMaxAppendBlockBytes()

使用されているサービス バージョンに基づいて、追加ブロックバイトの最大数を取得します。 サービス バージョン 2022-11-02 以降では、最大 100 MB のブロック バイトのアップロードがサポートされており、すべての古いサービス バージョンでは最大 4 MB がサポートされています。

Returns:

サービス のバージョンに基づいてアップロードできるブロック バイトの最大数。

getMaxBlocks

public int getMaxBlocks()

追加 BLOB で許可されるブロックの最大数を取得します。

Returns:

追加 BLOB にアップロードできるブロックの最大数。

seal

public void seal()

追加 BLOB をシールし、読み取り専用にします。 後続の追加は失敗します。

コード サンプル

client.seal();
 System.out.println("Sealed AppendBlob");

sealWithResponse

public Response sealWithResponse(AppendBlobSealOptions options, Duration timeout, Context context)

追加 BLOB をシールし、読み取り専用にします。 後続の追加は失敗します。

コード サンプル

AppendBlobRequestConditions requestConditions = new AppendBlobRequestConditions().setLeaseId(leaseId)
     .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
 Context context = new Context("key", "value");

 client.sealWithResponse(new AppendBlobSealOptions().setRequestConditions(requestConditions), timeout, context);
 System.out.println("Sealed AppendBlob");

Parameters:

timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

事後対応応答シグナルの完了。

適用対象