public final class CloudBlockBlob extends CloudBlob
blobServiceClient, parent, streamMinimumReadSizeInBytes, streamWriteSizeInBytes| Constructor and Description |
|---|
CloudBlockBlob(CloudBlockBlob otherBlob)
Creates an instance of the
CloudBlockBlob class by copying values from another cloud block blob. |
CloudBlockBlob(StorageUri blobAbsoluteUri)
Creates an instance of the
CloudBlockBlob class using the specified absolute StorageUri. |
CloudBlockBlob(StorageUri blobAbsoluteUri,
CloudBlobClient client)
Creates an instance of the
CloudBlockBlob class using the specified absolute StorageUri and storage
service client. |
CloudBlockBlob(StorageUri blobAbsoluteUri,
CloudBlobClient client,
CloudBlobContainer container)
Creates an instance of the
CloudBlockBlob class using the specified absolute StorageUri, storage
service client and container. |
CloudBlockBlob(StorageUri blobAbsoluteUri,
String snapshotID,
CloudBlobClient client)
Creates an instance of the
CloudBlockBlob class using the specified absolute StorageUri, snapshot
ID, and storage service client. |
CloudBlockBlob(URI blobAbsoluteUri)
Creates an instance of the
CloudBlockBlob class using the specified absolute URI. |
CloudBlockBlob(URI blobAbsoluteUri,
CloudBlobClient client)
Creates an instance of the
CloudBlockBlob class using the specified absolute URI and storage service
client. |
CloudBlockBlob(URI blobAbsoluteUri,
CloudBlobClient client,
CloudBlobContainer container)
Creates an instance of the
CloudBlockBlob class using the specified absolute URI, storage service
client and container. |
CloudBlockBlob(URI blobAbsoluteUri,
String snapshotID,
CloudBlobClient client)
Creates an instance of the
CloudBlockBlob class using the specified absolute URI, snapshot ID, and
storage service client. |
| Modifier and Type | Method and Description |
|---|---|
void |
commitBlockList(Iterable<BlockEntry> blockList)
Commits a block list to the storage service.
|
void |
commitBlockList(Iterable<BlockEntry> blockList,
AccessCondition accessCondition,
BlobRequestOptions options,
OperationContext opContext)
Commits a block list to the storage service using the specified lease ID, request options, and operation context.
|
ArrayList<BlockEntry> |
downloadBlockList()
Downloads the committed block list from the block blob.
|
ArrayList<BlockEntry> |
downloadBlockList(BlockListingFilter blockListingFilter,
AccessCondition accessCondition,
BlobRequestOptions options,
OperationContext opContext)
Downloads the block list from the block blob using the specified block listing filter, request options, and
operation context.
|
String |
downloadText()
Downloads a blob to a string using the platform's default encoding.
|
String |
downloadText(String charsetName,
AccessCondition accessCondition,
BlobRequestOptions options,
OperationContext opContext)
Downloads a blob to a string using the specified encoding.
|
BlobOutputStream |
openOutputStream()
Creates and opens an output stream to write data to the block blob.
|
BlobOutputStream |
openOutputStream(AccessCondition accessCondition,
BlobRequestOptions options,
OperationContext opContext)
Creates and opens an output stream to write data to the block blob using the specified request options and
operation context.
|
void |
setStreamWriteSizeInBytes(int streamWriteSizeInBytes)
Sets the number of bytes to buffer when writing to a
BlobOutputStream. |
void |
upload(InputStream sourceStream,
long length)
Uploads the source stream data to the block blob.
|
void |
upload(InputStream sourceStream,
long length,
AccessCondition accessCondition,
BlobRequestOptions options,
OperationContext opContext)
Uploads the source stream data to the blob, using the specified lease ID, request options, and operation context.
|
void |
uploadBlock(String blockId,
InputStream sourceStream,
long length)
Uploads a block to be committed as part of the block blob, using the specified block ID.
|
void |
uploadBlock(String blockId,
InputStream sourceStream,
long length,
AccessCondition accessCondition,
BlobRequestOptions options,
OperationContext opContext)
Uploads a block to be committed as part of the block blob, using the specified block ID, the specified lease ID,
request options, and operation context.
|
protected void |
uploadFullBlob(InputStream sourceStream,
long length,
AccessCondition accessCondition,
BlobRequestOptions options,
OperationContext opContext)
Uploads a blob in a single operation.
|
void |
uploadText(String content)
Uploads a blob from a string using the platform's default encoding.
|
void |
uploadText(String content,
String charsetName,
AccessCondition accessCondition,
BlobRequestOptions options,
OperationContext opContext)
Uploads a blob from a string using the specified encoding.
|
abortCopy, abortCopy, acquireLease, acquireLease, assertCorrectBlobType, assertNoWriteOperationForSnapshot, breakLease, breakLease, changeLease, changeLease, createSnapshot, createSnapshot, createSnapshot, delete, delete, deleteIfExists, deleteIfExists, download, download, downloadAttributes, downloadAttributes, downloadRange, downloadRange, downloadRangeInternal, downloadRangeToByteArray, downloadRangeToByteArray, downloadToByteArray, downloadToByteArray, downloadToFile, downloadToFile, exists, exists, generateSharedAccessSignature, generateSharedAccessSignature, getContainer, getCopyState, getMetadata, getName, getParent, getParentNameFromURI, getProperties, getQualifiedStorageUri, getQualifiedUri, getServiceClient, getSnapshotID, getStorageUri, getStreamMinimumReadSizeInBytes, getStreamWriteSizeInBytes, getTransformedAddress, getUri, isSnapshot, openInputStream, openInputStream, parseURIQueryStringAndVerify, releaseLease, releaseLease, renewLease, renewLease, setContainer, setMetadata, setProperties, setSnapshotID, setStorageUri, setStreamMinimumReadSizeInBytes, startCopyFromBlob, startCopyFromBlob, startCopyFromBlob, startCopyFromBlob, updateEtagAndLastModifiedFromResponse, updateLengthFromResponse, uploadFromByteArray, uploadFromByteArray, uploadFromFile, uploadFromFile, uploadMetadata, uploadMetadata, uploadProperties, uploadPropertiespublic CloudBlockBlob(URI blobAbsoluteUri) throws StorageException
CloudBlockBlob class using the specified absolute URI.blobAbsoluteUri - A java.net.URI object that represents the absolute URI to the blob.StorageException - If a storage service error occurred.public CloudBlockBlob(StorageUri blobAbsoluteUri) throws StorageException
CloudBlockBlob class using the specified absolute StorageUri.blobAbsoluteUri - A StorageUri object that represents the absolute URI to the blob.StorageException - If a storage service error occurred.public CloudBlockBlob(CloudBlockBlob otherBlob)
CloudBlockBlob class by copying values from another cloud block blob.otherBlob - A CloudBlockBlob object that represents the block blob to copy.public CloudBlockBlob(URI blobAbsoluteUri, CloudBlobClient client) throws StorageException
CloudBlockBlob class using the specified absolute URI and storage service
client.blobAbsoluteUri - A java.net.URI object that represents the absolute URI to the blob.client - A CloudBlobClient object that specifies the endpoint for the Blob service.StorageException - If a storage service error occurred.public CloudBlockBlob(StorageUri blobAbsoluteUri, CloudBlobClient client) throws StorageException
CloudBlockBlob class using the specified absolute StorageUri and storage
service client.blobAbsoluteUri - A StorageUri object that represents the absolute URI to the blob.client - A CloudBlobClient object that specifies the endpoint for the Blob service.StorageException - If a storage service error occurred.public CloudBlockBlob(URI blobAbsoluteUri, CloudBlobClient client, CloudBlobContainer container) throws StorageException
CloudBlockBlob class using the specified absolute URI, storage service
client and container.blobAbsoluteUri - A java.net.URI object that represents the absolute URI to the blob.client - A CloudBlobClient object that specifies the endpoint for the Blob service.container - A CloudBlobContainer object that represents the container to use for the blob.StorageException - If a storage service error occurred.public CloudBlockBlob(StorageUri blobAbsoluteUri, CloudBlobClient client, CloudBlobContainer container) throws StorageException
CloudBlockBlob class using the specified absolute StorageUri, storage
service client and container.blobAbsoluteUri - A StorageUri object that represents the absolute URI to the blob.client - A CloudBlobClient object that specifies the endpoint for the Blob service.container - A CloudBlobContainer object that represents the container to use for the blob.StorageException - If a storage service error occurred.public CloudBlockBlob(URI blobAbsoluteUri, String snapshotID, CloudBlobClient client) throws StorageException
CloudBlockBlob class using the specified absolute URI, snapshot ID, and
storage service client.blobAbsoluteUri - A java.net.URI object that represents the absolute URI to the blob.snapshotID - A String that represents the snapshot version, if applicable.client - A CloudBlobClient object that specifies the endpoint for the Blob service.StorageException - If a storage service error occurred.public CloudBlockBlob(StorageUri blobAbsoluteUri, String snapshotID, CloudBlobClient client) throws StorageException
CloudBlockBlob class using the specified absolute StorageUri, snapshot
ID, and storage service client.blobAbsoluteUri - A StorageUri object that represents the absolute URI to the blob.snapshotID - A String that represents the snapshot version, if applicable.client - A CloudBlobClient object that specifies the endpoint for the Blob service.StorageException - If a storage service error occurred.@DoesServiceRequest public void commitBlockList(Iterable<BlockEntry> blockList) throws StorageException
blockList - An enumerable collection of BlockEntry objects that represents the list block items being
committed. The size field is ignored.StorageException - If a storage service error occurred.@DoesServiceRequest public void commitBlockList(Iterable<BlockEntry> blockList, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException
blockList - An enumerable collection of BlockEntry objects that represents the list block items being
committed. The size field is ignored.accessCondition - An AccessCondition object that represents the access conditions for the blob.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException - If a storage service error occurred.@DoesServiceRequest public ArrayList<BlockEntry> downloadBlockList() throws StorageException
The committed block list includes the list of blocks that have been successfully committed to the block blob. The list of committed blocks is returned in the same order that they were committed to the blob. No block may appear more than once in the committed block list.
ArrayList object of BlockEntry objects that represent the committed list
block items downloaded from the block blob.StorageException - If a storage service error occurred.@DoesServiceRequest public ArrayList<BlockEntry> downloadBlockList(BlockListingFilter blockListingFilter, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException
The committed block list includes the list of blocks that have been successfully committed to the block blob. The list of committed blocks is returned in the same order that they were committed to the blob. No block may appear more than once in the committed block list.
blockListingFilter - A BlockListingFilter value that specifies whether to download committed blocks, uncommitted
blocks, or all blocks.accessCondition - An AccessCondition object that represents the access conditions for the blob.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.ArrayList object of BlockEntry objects that represent the list block items
downloaded from the block blob.StorageException - If a storage service error occurred.public BlobOutputStream openOutputStream() throws StorageException
BlobOutputStream object used to write data to the blob.StorageException - If a storage service error occurred.public BlobOutputStream openOutputStream(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException
accessCondition - An AccessCondition object that represents the access conditions for the blob.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.BlobOutputStream object used to write data to the blob.StorageException - If a storage service error occurred.@DoesServiceRequest public void upload(InputStream sourceStream, long length) throws StorageException, IOException
upload in class CloudBlobsourceStream - An InputStream object that represents the input stream to write to the block blob.length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.IOException - If an I/O error occurred.StorageException - If a storage service error occurred.@DoesServiceRequest public void upload(InputStream sourceStream, long length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException
upload in class CloudBlobsourceStream - An InputStream object that represents the input stream to write to the block blob.length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.accessCondition - An AccessCondition object that represents the access conditions for the blob.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.IOException - If an I/O error occurred.StorageException - If a storage service error occurred.@DoesServiceRequest protected final void uploadFullBlob(InputStream sourceStream, long length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException
sourceStream - A InputStream object that represents the source stream to upload.length - The length, in bytes, of the stream, or -1 if unknown.accessCondition - An AccessCondition object that represents the access conditions for the blob.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException - If a storage service error occurred.@DoesServiceRequest public void uploadBlock(String blockId, InputStream sourceStream, long length) throws StorageException, IOException
blockId - A String that represents the Base-64 encoded block ID. Note for a given blob the length
of all Block IDs must be identical.sourceStream - An InputStream object that represents the input stream to write to the block blob.length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.IOException - If an I/O error occurred.StorageException - If a storage service error occurred.@DoesServiceRequest public void uploadBlock(String blockId, InputStream sourceStream, long length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException
blockId - A String that represents the Base-64 encoded block ID. Note for a given blob the length
of all Block IDs must be identical.sourceStream - An InputStream object that represents the input stream to write to the block blob.length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.accessCondition - An AccessCondition object that represents the access conditions for the blob.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.IOException - If an I/O error occurred.StorageException - If a storage service error occurred.public void uploadText(String content) throws StorageException, IOException
content - A String which represents the content that will be uploaded to the blob.StorageException - If a storage service error occurred.IOExceptionpublic void uploadText(String content, String charsetName, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException
content - A String which represents the content that will be uploaded to the blob.charsetName - A String which represents the name of the charset to use to encode the content.
If null, the platform's default encoding is used.accessCondition - An AccessCondition object that represents the access conditions for the blob.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException - If a storage service error occurred.IOExceptionpublic String downloadText() throws StorageException, IOException
String which represents the blob's contents.StorageException - If a storage service error occurred.IOExceptionpublic String downloadText(String charsetName, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException
charsetName - A String which represents the name of the charset to use to encode the content.
If null, the platform's default encoding is used.accessCondition - An AccessCondition object that represents the access conditions for the blob.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.String which represents the blob's contents.StorageException - If a storage service error occurred.IOExceptionpublic void setStreamWriteSizeInBytes(int streamWriteSizeInBytes)
BlobOutputStream.setStreamWriteSizeInBytes in class CloudBlobwriteBlockSizeInBytes - An int which represents the maximum block size, in bytes, for writing to a block blob
while using a BlobOutputStream object, ranging from 16 KB to 4 MB, inclusive.IllegalArgumentException - If streamWriteSizeInBytes is less than 16 KB or greater than 4 MB./**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/