Class EncryptedBlobClient
Please refer to the Azure Docs For Client-Side Encryption for more information.
This client is instantiated through EncryptedBlobClientBuilder
For operations on a specific blob type (i.e. append, block, or page) use
getAppendBlobClient, getBlockBlobClient, or getPageBlobAsyncClient to construct a client that
allows blob specific operations. Note, these types do not support client-side encryption, though decryption is
possible in case the associated block/page/append blob contains encrypted data.
Please refer to the Azure Docs for more information.
-
Field Summary
Fields inherited from class com.azure.storage.blob.BlobClient
BLOB_DEFAULT_HTBB_UPLOAD_BLOCK_SIZE, BLOB_DEFAULT_NUMBER_OF_BUFFERS, BLOB_DEFAULT_UPLOAD_BLOCK_SIZE -
Method Summary
Modifier and TypeMethodDescriptionvoiddownload(OutputStream stream) Deprecated.com.azure.core.util.BinaryDatadownloadContentWithResponse(DownloadRetryOptions options, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) voiddownloadStream(OutputStream stream) downloadStreamWithResponse(OutputStream stream, BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, com.azure.core.util.Context context) downloadToFile(String filePath) downloadToFile(String filePath, boolean overwrite) com.azure.core.http.rest.Response<BlobProperties>downloadToFileWithResponse(BlobDownloadToFileOptions options, Duration timeout, com.azure.core.util.Context context) com.azure.core.http.rest.Response<BlobProperties>downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Duration timeout, com.azure.core.util.Context context) com.azure.core.http.rest.Response<BlobProperties>downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions, Duration timeout, com.azure.core.util.Context context) downloadWithResponse(OutputStream stream, BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, com.azure.core.util.Context context) Deprecated.Unsupported.Creates and opens an output stream to write data to the block blob.getBlobOutputStream(boolean overwrite) Creates and opens an output stream to write data to the block blob.getBlobOutputStream(ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions) Creates and opens an output stream to write data to the block blob.Creates and opens an output stream to write data to the block blob.Unsupported.getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey) Creates a newEncryptedBlobClientwith the specifiedcustomerProvidedKey.getEncryptionScopeClient(String encryptionScope) Creates a newEncryptedBlobClientwith the specifiedencryptionScope.Unsupported.openInputStream(BlobRange range, BlobRequestConditions requestConditions) openInputStream(BlobInputStreamOptions options) openInputStream(BlobInputStreamOptions options, com.azure.core.util.Context context) openQueryInputStream(String expression) Unsupported.com.azure.core.http.rest.Response<InputStream>openQueryInputStreamWithResponse(BlobQueryOptions queryOptions) Unsupported.voidquery(OutputStream stream, String expression) Unsupported.queryWithResponse(BlobQueryOptions queryOptions, Duration timeout, com.azure.core.util.Context context) Unsupported.voiduploadFromFile(String filePath) Creates a new block blob, or updates the content of an existing block blob.voiduploadFromFile(String filePath, boolean overwrite) Creates a new block blob, or updates the content of an existing block blob.voiduploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions, Duration timeout) Creates a new block blob, or updates the content of an existing block blob.com.azure.core.http.rest.Response<BlockBlobItem>uploadFromFileWithResponse(BlobUploadFromFileOptions options, Duration timeout, com.azure.core.util.Context context) Creates a new block blob, or updates the content of an existing block blob.Methods inherited from class com.azure.storage.blob.BlobClient
getSnapshotClient, getVersionClient, upload, upload, upload, upload, upload, upload, uploadWithResponse, uploadWithResponse, uploadWithResponseMethods inherited from class com.azure.storage.blob.specialized.BlobClientBase
abortCopyFromUrl, abortCopyFromUrlWithResponse, beginCopy, beginCopy, beginCopy, copyFromUrl, copyFromUrlWithResponse, copyFromUrlWithResponse, createSnapshot, createSnapshotWithResponse, delete, deleteIfExists, deleteIfExistsWithResponse, deleteImmutabilityPolicy, deleteImmutabilityPolicyWithResponse, deleteWithResponse, exists, existsWithResponse, generateSas, generateSas, generateUserDelegationSas, generateUserDelegationSas, getAccountInfo, getAccountInfoWithResponse, getAccountName, getAccountUrl, getBlobName, getBlobUrl, getContainerClient, getContainerName, getCustomerProvidedKey, getEncryptionScope, getHttpPipeline, getProperties, getPropertiesWithResponse, getServiceVersion, getSnapshotId, getTags, getTagsWithResponse, getVersionId, isSnapshot, openSeekableByteChannelRead, setAccessTier, setAccessTierWithResponse, setAccessTierWithResponse, setHttpHeaders, setHttpHeadersWithResponse, setImmutabilityPolicy, setImmutabilityPolicyWithResponse, setLegalHold, setLegalHoldWithResponse, setMetadata, setMetadataWithResponse, setTags, setTagsWithResponse, undelete, undeleteWithResponse
-
Method Details
-
getEncryptionScopeClient
Creates a newEncryptedBlobClientwith the specifiedencryptionScope.- Overrides:
getEncryptionScopeClientin classBlobClient- Parameters:
encryptionScope- the encryption scope for the blob, passnullto use no encryption scope.- Returns:
- a
EncryptedBlobClientwith the specifiedencryptionScope.
-
getCustomerProvidedKeyClient
Creates a newEncryptedBlobClientwith the specifiedcustomerProvidedKey.- Overrides:
getCustomerProvidedKeyClientin classBlobClient- Parameters:
customerProvidedKey- theCustomerProvidedKeyfor the blob, passnullto use no customer provided key.- Returns:
- a
EncryptedBlobClientwith the specifiedcustomerProvidedKey.
-
getBlobOutputStream
Creates and opens an output stream to write data to the block blob.Note: We recommend you call write with reasonably sized buffers, you can do so by wrapping the BlobOutputStream obtained below with a
BufferedOutputStream.- Returns:
- A
BlobOutputStreamobject used to write data to the blob. - Throws:
BlobStorageException- If a storage service error occurred.
-
getBlobOutputStream
Creates and opens an output stream to write data to the block blob.Note: We recommend you call write with reasonably sized buffers, you can do so by wrapping the BlobOutputStream obtained below with a
BufferedOutputStream.- Parameters:
overwrite- Whether to overwrite, should data exist on the blob.- Returns:
- A
BlobOutputStreamobject used to write data to the blob. - Throws:
BlobStorageException- If a storage service error occurred.
-
getBlobOutputStream
public BlobOutputStream getBlobOutputStream(ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions) Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, it will be overwritten.To avoid overwriting, pass "*" to
BlobRequestConditions.setIfNoneMatch(String).Note: We recommend you call write with reasonably sized buffers, you can do so by wrapping the BlobOutputStream obtained below with a
BufferedOutputStream.- Parameters:
parallelTransferOptions-ParallelTransferOptionsused to configure buffered uploading.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.tier-AccessTierfor the destination blob.requestConditions-BlobRequestConditions- Returns:
- A
BlobOutputStreamobject used to write data to the blob. - Throws:
BlobStorageException- If a storage service error occurred.
-
getBlobOutputStream
Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, it will be overwritten.To avoid overwriting, pass "*" to
BlobRequestConditions.setIfNoneMatch(String).Note: We recommend you call write with reasonably sized buffers, you can do so by wrapping the BlobOutputStream obtained below with a
BufferedOutputStream.- Parameters:
options-BlockBlobOutputStreamOptions- Returns:
- A
BlobOutputStreamobject used to write data to the blob. - Throws:
BlobStorageException- If a storage service error occurred.
-
uploadFromFile
Creates a new block blob, or updates the content of an existing block blob.Code Samples
try { client.uploadFromFile(filePath); System.out.println("Upload from file succeeded"); } catch (UncheckedIOException ex) { System.err.printf("Failed to upload from file %s%n", ex.getMessage()); }- Overrides:
uploadFromFilein classBlobClient- Parameters:
filePath- Path of the file to upload
-
uploadFromFile
Creates a new block blob, or updates the content of an existing block blob.Code Samples
try { boolean overwrite = false; // Default value client.uploadFromFile(filePath, overwrite); System.out.println("Upload from file succeeded"); } catch (UncheckedIOException ex) { System.err.printf("Failed to upload from file %s%n", ex.getMessage()); }- Overrides:
uploadFromFilein classBlobClient- Parameters:
filePath- Path of the file to uploadoverwrite- Whether to overwrite should data already exist on the blob
-
uploadFromFile
public void uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions, Duration timeout) throws UncheckedIOExceptionCreates a new block blob, or updates the content of an existing block blob.Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentMd5("data".getBytes(StandardCharsets.UTF_8)) .setContentLanguage("en-US") .setContentType("binary"); Map<String, String> metadata = new HashMap<>(Collections.singletonMap("metadata", "value")); BlobRequestConditions requestConditions = new BlobRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); long blockSize = 100 * 1024 * 1024; // 100 MB; ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize); try { client.uploadFromFile(filePath, parallelTransferOptions, headers, metadata, AccessTier.HOT, requestConditions, timeout); System.out.println("Upload from file succeeded"); } catch (UncheckedIOException ex) { System.err.printf("Failed to upload from file %s%n", ex.getMessage()); }- Overrides:
uploadFromFilein classBlobClient- Parameters:
filePath- Path of the file to uploadparallelTransferOptions-ParallelTransferOptionsto use to upload from file. Number of parallel transfers parameter is ignored.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.tier-AccessTierfor the uploaded blobrequestConditions-BlobRequestConditionstimeout- An optional timeout value beyond which aRuntimeExceptionwill be raised.- Throws:
UncheckedIOException- If an I/O error occurs
-
uploadFromFileWithResponse
public com.azure.core.http.rest.Response<BlockBlobItem> uploadFromFileWithResponse(BlobUploadFromFileOptions options, Duration timeout, com.azure.core.util.Context context) throws UncheckedIOException Creates a new block blob, or updates the content of an existing block blob.Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentMd5("data".getBytes(StandardCharsets.UTF_8)) .setContentLanguage("en-US") .setContentType("binary"); Map<String, String> metadata = new HashMap<>(Collections.singletonMap("metadata", "value")); Map<String, String> tags = new HashMap<>(Collections.singletonMap("tag", "value")); BlobRequestConditions requestConditions = new BlobRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); long blockSize = 100 * 1024 * 1024; // 100 MB; ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize); try { client.uploadFromFileWithResponse(new BlobUploadFromFileOptions(filePath) .setParallelTransferOptions(parallelTransferOptions).setHeaders(headers).setMetadata(metadata) .setTags(tags).setTier(AccessTier.HOT).setRequestConditions(requestConditions), timeout, Context.NONE); System.out.println("Upload from file succeeded"); } catch (UncheckedIOException ex) { System.err.printf("Failed to upload from file %s%n", ex.getMessage()); }- Overrides:
uploadFromFileWithResponsein classBlobClient- Parameters:
options-BlobUploadFromFileOptionstimeout- An optional timeout value beyond which aRuntimeExceptionwill be raised.context- Additional context that is passed through the Http pipeline during the service call.- Returns:
- Information about the uploaded block blob.
- Throws:
UncheckedIOException- If an I/O error occurs
-
downloadToFile
- Overrides:
downloadToFilein classBlobClientBase
-
downloadToFile
- Overrides:
downloadToFilein classBlobClientBase
-
downloadToFileWithResponse
public com.azure.core.http.rest.Response<BlobProperties> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Duration timeout, com.azure.core.util.Context context) - Overrides:
downloadToFileWithResponsein classBlobClientBase
-
downloadToFileWithResponse
public com.azure.core.http.rest.Response<BlobProperties> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions, Duration timeout, com.azure.core.util.Context context) - Overrides:
downloadToFileWithResponsein classBlobClientBase
-
downloadToFileWithResponse
public com.azure.core.http.rest.Response<BlobProperties> downloadToFileWithResponse(BlobDownloadToFileOptions options, Duration timeout, com.azure.core.util.Context context) - Overrides:
downloadToFileWithResponsein classBlobClientBase
-
openInputStream
- Overrides:
openInputStreamin classBlobClientBase
-
openInputStream
- Overrides:
openInputStreamin classBlobClientBase
-
openInputStream
- Overrides:
openInputStreamin classBlobClientBase
-
openInputStream
public BlobInputStream openInputStream(BlobInputStreamOptions options, com.azure.core.util.Context context) - Overrides:
openInputStreamin classBlobClientBase
-
download
Deprecated.- Overrides:
downloadin classBlobClientBase
-
downloadStream
- Overrides:
downloadStreamin classBlobClientBase
-
downloadContent
public com.azure.core.util.BinaryData downloadContent()- Overrides:
downloadContentin classBlobClientBase
-
downloadWithResponse
@Deprecated public BlobDownloadResponse downloadWithResponse(OutputStream stream, BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, com.azure.core.util.Context context) Deprecated.- Overrides:
downloadWithResponsein classBlobClientBase
-
downloadStreamWithResponse
public BlobDownloadResponse downloadStreamWithResponse(OutputStream stream, BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, com.azure.core.util.Context context) - Overrides:
downloadStreamWithResponsein classBlobClientBase
-
downloadContentWithResponse
public BlobDownloadContentResponse downloadContentWithResponse(DownloadRetryOptions options, BlobRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) - Overrides:
downloadContentWithResponsein classBlobClientBase
-
getAppendBlobClient
Unsupported.- Overrides:
getAppendBlobClientin classBlobClient
-
getBlockBlobClient
Unsupported.- Overrides:
getBlockBlobClientin classBlobClient
-
getPageBlobClient
Unsupported.- Overrides:
getPageBlobClientin classBlobClient
-
openQueryInputStream
Unsupported. Cannot query data encrypted on client side.- Overrides:
openQueryInputStreamin classBlobClientBase
-
openQueryInputStreamWithResponse
public com.azure.core.http.rest.Response<InputStream> openQueryInputStreamWithResponse(BlobQueryOptions queryOptions) Unsupported. Cannot query data encrypted on client side.- Overrides:
openQueryInputStreamWithResponsein classBlobClientBase
-
query
Unsupported. Cannot query data encrypted on client side.- Overrides:
queryin classBlobClientBase
-
queryWithResponse
public BlobQueryResponse queryWithResponse(BlobQueryOptions queryOptions, Duration timeout, com.azure.core.util.Context context) Unsupported. Cannot query data encrypted on client side.- Overrides:
queryWithResponsein classBlobClientBase
-