public final class CloudBlockBlob extends CloudBlob
blobServiceClient, parent, streamMinimumReadSizeInBytes, streamWriteSizeInBytes
Modifier | 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,
StorageCredentials credentials)
Creates an instance of the
CloudBlockBlob class using the specified absolute StorageUri and credentials. |
|
CloudBlockBlob(StorageUri blobAbsoluteUri,
String snapshotID,
StorageCredentials credentials)
Creates an instance of the
CloudBlockBlob class using the specified absolute StorageUri, snapshot
ID, and credentials. |
protected |
CloudBlockBlob(String blobName,
String snapshotID,
CloudBlobContainer container)
Creates an instance of the
CloudBlockBlob class using the specified type, name, snapshot ID, and
container. |
|
CloudBlockBlob(URI blobAbsoluteUri)
Creates an instance of the
CloudBlockBlob class using the specified absolute URI. |
|
CloudBlockBlob(URI blobAbsoluteUri,
StorageCredentials credentials)
Creates an instance of the
CloudBlockBlob class using the specified absolute URI and credentials. |
|
CloudBlockBlob(URI blobAbsoluteUri,
String snapshotID,
StorageCredentials credentials)
Creates an instance of the
CloudBlockBlob class using the specified absolute URI, snapshot ID, and
credentials. |
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.
|
boolean |
isStreamWriteSizeModified()
Gets the flag that indicates whether the default streamWriteSize was modified.
|
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 . |
String |
startCopy(CloudBlockBlob sourceBlob)
Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob.
|
String |
startCopy(CloudBlockBlob sourceBlob,
AccessCondition sourceAccessCondition,
AccessCondition destinationAccessCondition,
BlobRequestOptions options,
OperationContext opContext)
Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob,
using the specified access conditions, lease ID, request options, and operation context.
|
String |
startCopy(CloudFile sourceFile)
Requests the service to start copying a file's contents, properties, and metadata to a new block blob.
|
String |
startCopy(CloudFile sourceFile,
AccessCondition sourceAccessCondition,
AccessCondition destinationAccessCondition,
BlobRequestOptions options,
OperationContext opContext)
Requests the service to start copying a file's contents, properties, and metadata to a new block blob,
using the specified access conditions, lease ID, request options, and operation context.
|
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 |
uploadStandardBlobTier(StandardBlobTier standardBlobTier)
Sets the blob tier on a block blob on a standard storage account.
|
void |
uploadStandardBlobTier(StandardBlobTier standardBlobTier,
BlobRequestOptions options,
OperationContext opContext)
Sets the tier on a block blob on a standard storage account.
|
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, 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, generateSharedAccessSignature, getContainer, getCopyState, getMetadata, getName, getParent, getParentNameFromURI, getProperties, getQualifiedStorageUri, getQualifiedUri, getServiceClient, getSnapshotID, getSnapshotQualifiedStorageUri, getSnapshotQualifiedUri, getStorageUri, getStreamMinimumReadSizeInBytes, getStreamWriteSizeInBytes, getTransformedAddress, getUri, isSnapshot, openInputStream, openInputStream, releaseLease, releaseLease, renewLease, renewLease, setContainer, setMetadata, setProperties, setSnapshotID, setStorageUri, setStreamMinimumReadSizeInBytes, startCopy, startCopy, startCopy, startCopyImpl, updateEtagAndLastModifiedFromResponse, updateLengthFromResponse, uploadBlobTierImpl, uploadFromByteArray, uploadFromByteArray, uploadFromFile, uploadFromFile, uploadMetadata, uploadMetadata, uploadProperties, uploadProperties
public 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, StorageCredentials credentials) throws StorageException
CloudBlockBlob
class using the specified absolute URI and credentials.blobAbsoluteUri
- A java.net.URI
object that represents the absolute URI to the blob.credentials
- A StorageCredentials
object used to authenticate access.StorageException
- If a storage service error occurred.public CloudBlockBlob(StorageUri blobAbsoluteUri, StorageCredentials credentials) throws StorageException
CloudBlockBlob
class using the specified absolute StorageUri and credentials.blobAbsoluteUri
- A StorageUri
object that represents the absolute StorageUri to the blob.credentials
- A StorageCredentials
object used to authenticate access.StorageException
- If a storage service error occurred.public CloudBlockBlob(URI blobAbsoluteUri, String snapshotID, StorageCredentials credentials) throws StorageException
CloudBlockBlob
class using the specified absolute URI, snapshot ID, and
credentials.blobAbsoluteUri
- A java.net.URI
object that represents the absolute URI to the blob.snapshotID
- A String
that represents the snapshot version, if applicable.credentials
- A StorageCredentials
object used to authenticate access.StorageException
- If a storage service error occurred.public CloudBlockBlob(StorageUri blobAbsoluteUri, String snapshotID, StorageCredentials credentials) throws StorageException
CloudBlockBlob
class using the specified absolute StorageUri, snapshot
ID, and credentials.blobAbsoluteUri
- A StorageUri
object that represents the absolute StorageUri to the blob.snapshotID
- A String
that represents the snapshot version, if applicable.credentials
- A StorageCredentials
object used to authenticate access.StorageException
- If a storage service error occurred.protected CloudBlockBlob(String blobName, String snapshotID, CloudBlobContainer container) throws URISyntaxException
CloudBlockBlob
class using the specified type, name, snapshot ID, and
container.blobName
- Name of the blob.snapshotID
- A String
that represents the snapshot version, if applicable.container
- The reference to the parent container.URISyntaxException
- If the resource URI is invalid.@DoesServiceRequest public final String startCopy(CloudBlockBlob sourceBlob) throws StorageException, URISyntaxException
sourceBlob
- A CloudBlockBlob
object that represents the source blob to copy.String
which represents the copy ID associated with the copy operation.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public final String startCopy(CloudBlockBlob sourceBlob, AccessCondition sourceAccessCondition, AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException
sourceBlob
- A CloudBlockBlob
object that represents the source blob to copy.sourceAccessCondition
- An AccessCondition
object that represents the access conditions for the source blob.destinationAccessCondition
- An AccessCondition
object that represents the access conditions for the destination 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 copy ID associated with the copy operation.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public final String startCopy(CloudFile sourceFile) throws StorageException, URISyntaxException
sourceFile
- A CloudFile
object that represents the source file to copy.String
which represents the copy ID associated with the copy operation.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public final String startCopy(CloudFile sourceFile, AccessCondition sourceAccessCondition, AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException
sourceFile
- A CloudFile
object that represents the source file to copy.sourceAccessCondition
- An AccessCondition
object that represents the access conditions for the source file.destinationAccessCondition
- An AccessCondition
object that represents the access conditions for the destination block 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 copy ID associated with the copy operation.StorageException
- If a storage service error occurred.URISyntaxException
- If the resource URI is invalid.@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
To avoid overwriting and instead throw an error, please use the
openOutputStream(AccessCondition, BlobRequestOptions, OperationContext)
overload with the appropriate
AccessCondition
.
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
To avoid overwriting and instead throw an error, please pass in an AccessCondition
generated using
AccessCondition.generateIfNotExistsCondition()
.
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 CloudBlob
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 upload(InputStream sourceStream, long length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException
upload
in class CloudBlob
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.@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.IOException
public 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.IOException
public String downloadText() throws StorageException, IOException
String
which represents the blob's contents.StorageException
- If a storage service error occurred.IOException
public 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.IOException
public void setStreamWriteSizeInBytes(int streamWriteSizeInBytes)
BlobOutputStream
.setStreamWriteSizeInBytes
in class CloudBlob
streamWriteSizeInBytes
- 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 100 MB, inclusive.IllegalArgumentException
- If streamWriteSizeInBytes
is less than 16 KB or greater than 100 MB.@DoesServiceRequest public void uploadStandardBlobTier(StandardBlobTier standardBlobTier) throws StorageException
standardBlobTier
- A StandardBlobTier
object which represents the tier of the blob.StorageException
- If a storage service error occurred.@DoesServiceRequest public void uploadStandardBlobTier(StandardBlobTier standardBlobTier, BlobRequestOptions options, OperationContext opContext) throws StorageException
standardBlobTier
- A StandardBlobTier
object which represents the tier of 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 which 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.public boolean isStreamWriteSizeModified()
Copyright © 2019. All rights reserved.