CloudAppendBlob Class

public class CloudAppendBlob extends CloudBlob

Represents a Microsoft Azure Append Blob.

Constructor Summary

Constructor Description
CloudAppendBlob(final CloudAppendBlob otherBlob)

Creates an instance of the class by copying values from another append blob.

CloudAppendBlob(final StorageUri blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI and storage service client.

CloudAppendBlob(final StorageUri blobAbsoluteUri, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute StorageUri and credentials.

CloudAppendBlob(final StorageUri blobAbsoluteUri, final String snapshotID, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute StorageUri, snapshot ID, and credentials.

CloudAppendBlob(final URI blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI and storage service client.

CloudAppendBlob(final URI blobAbsoluteUri, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute URI and credentials.

CloudAppendBlob(final URI blobAbsoluteUri, final String snapshotID, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute URI, snapshot ID, and credentials.

CloudAppendBlob(String blobName, String snapshotID, CloudBlobContainer container)

Creates an instance of the class using the specified type, name, snapshot ID, and container.

Method Summary

Modifier and Type Method and Description
void append(InputStream sourceStream, final long length)

Appends a stream to an append blob. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void append(InputStream sourceStream, final long length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Appends a stream to an append blob. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Long appendBlock(final InputStream sourceStream, final long length)

Commits a new block of data to the end of the blob.

Long appendBlock(final InputStream sourceStream, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Commits a new block of data to the end of the blob.

Long appendBlockFromURI(final URI copySource, final Long offset, final Long length)

Appends a block, using the specified source URL.

Long appendBlockFromURI(final URI copySource, final Long offset, final Long length, String md5, final AccessCondition accessCondition, final AccessCondition sourceAccessCondition, BlobRequestOptions options, OperationContext opContext)

Appends a block, using the specified source URL.

void appendFromByteArray(final byte[] buffer, final int offset, final int length)

Appends the contents of a byte array to an append blob.This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void appendFromByteArray(final byte[] buffer, final int offset, final int length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Appends the contents of a byte array to an append blob.This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void appendFromFile(final String path)

Appends a file to an append blob. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void appendFromFile(final String path, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Appends a file to an append blob. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void appendText(final String content)

Appends a string of text to an append blob using the platform's default encoding. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void appendText(final String content, final String charsetName, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Appends a string of text to an append blob using the specified encoding. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void createOrReplace()

Creates an empty append blob. If the blob already exists, this will replace it.

To avoid overwriting and instead throw an error, please use the createOrReplace(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) overload with the appropriate AccessCondition.

void createOrReplace(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Creates an append blob using the specified request options and operation context. If the blob already exists, this will replace it.

To avoid overwriting and instead throw an error, please pass in an AccessCondition generated using generateIfNotExistsCondition().

BlobOutputStream openWriteExisting()

Opens an output stream object to write data to the append blob. The append blob must already exist and will be appended to.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

BlobOutputStream openWriteExisting(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Opens an output stream object to write data to the append blob, using the specified lease ID, request options and operation context. The append blob must already exist and will be appended to.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

BlobOutputStream openWriteNew()

Opens an output stream object to write data to the append blob. The append blob does not need to yet exist. If the blob already exists, this will replace it.

To avoid overwriting and instead throw an error, please use the openWriteNew(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) overload with the appropriate AccessCondition.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

BlobOutputStream openWriteNew(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Opens an output stream object to write data to the append blob, using the specified lease ID, request options and operation context. The append blob does not need to yet exist. If the blob already exists, this will replace it.

To avoid overwriting and instead throw an error, please pass in an AccessCondition generated using generateIfNotExistsCondition().

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void setStreamWriteSizeInBytes(final int streamWriteSizeInBytes)

Sets the number of bytes to buffer when writing to a BlobOutputStream.

final String startCopy(final CloudAppendBlob sourceBlob)

Requests the service to start copying a append blob's contents, properties, and metadata to a new append blob.

final String startCopy(final CloudAppendBlob sourceBlob, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a append blob's contents, properties, and metadata to a new append blob, using the specified access conditions, lease ID, request options, and operation context.

void upload(final InputStream sourceStream, final long length)

Uploads the source stream data to the append blob. If the blob already exists on the service, it will be overwritten.

If you want to append data to an already existing blob, please see appendBlock(final InputStream sourceStream, final long length).

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

void upload(final InputStream sourceStream, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads the source stream data to the append blob using the specified lease ID, request options, and operation context. If the blob already exists on the service, it will be overwritten.

If you want to append data to an already existing blob, please see appendBlock(final InputStream sourceStream, final long length).

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Inherited Members

CloudBlob.abortCopy(final String copyId) CloudBlob.abortCopy(final String copyId, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.acquireLease() CloudBlob.acquireLease(final Integer leaseTimeInSeconds, final String proposedLeaseId) CloudBlob.acquireLease(final Integer leaseTimeInSeconds, final String proposedLeaseId, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.assertCorrectBlobType() CloudBlob.assertNoWriteOperationForSnapshot() CloudBlob.blobServiceClient CloudBlob.breakLease(final Integer breakPeriodInSeconds) CloudBlob.breakLease(final Integer breakPeriodInSeconds, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.changeLease(final String proposedLeaseId, final AccessCondition accessCondition) CloudBlob.changeLease(final String proposedLeaseId, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.CloudBlob(final BlobType type, String blobName, String snapshotID, CloudBlobContainer container) CloudBlob.CloudBlob(final BlobType type, final StorageUri uri, final String snapshotID, final StorageCredentials credentials) CloudBlob.CloudBlob(final CloudBlob otherBlob) CloudBlob.createSnapshot() CloudBlob.createSnapshot(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.createSnapshot(final HashMap<String, String> metadata, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.delete() CloudBlob.delete(final DeleteSnapshotsOption deleteSnapshotsOption, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.deleteIfExists() CloudBlob.deleteIfExists(final DeleteSnapshotsOption deleteSnapshotsOption, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.download(final OutputStream outStream) CloudBlob.download(final OutputStream outStream, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadAccountInfo() CloudBlob.downloadAccountInfo(BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadAccountInformationImpl(final RequestOptions options) CloudBlob.downloadAttributes() CloudBlob.downloadAttributes(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadRange(final long offset, final Long length, final OutputStream outStream) CloudBlob.downloadRange(final long offset, final Long length, final OutputStream outStream, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadRangeInternal(final long blobOffset, final Long length, final byte[] buffer, final int bufferOffset, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadRangeToByteArray(final long offset, final Long length, final byte[] buffer, final int bufferOffset) CloudBlob.downloadRangeToByteArray(final long offset, final Long length, final byte[] buffer, final int bufferOffset, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadToByteArray(final byte[] buffer, final int bufferOffset) CloudBlob.downloadToByteArray(final byte[] buffer, final int bufferOffset, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.downloadToFile(final String path) CloudBlob.downloadToFile(final String path, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.exists() CloudBlob.exists(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final String groupPolicyIdentifier) CloudBlob.generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers, final String groupPolicyIdentifier) CloudBlob.generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers, final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols) CloudBlob.generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers, final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols, boolean skipDecoding) CloudBlob.generateUserDelegationSharedAccessSignature(UserDelegationKey delegationKey, SharedAccessBlobPolicy policy) CloudBlob.generateUserDelegationSharedAccessSignature(final UserDelegationKey delegationKey, final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers, final IPRange ipRange, final SharedAccessProtocols protocols) CloudBlob.getContainer() CloudBlob.getCopyState() CloudBlob.getMetadata() CloudBlob.getName() CloudBlob.getParent() CloudBlob.getParentNameFromURI(final StorageUri resourceAddress, final String delimiter, final CloudBlobContainer container) CloudBlob.getProperties() CloudBlob.getQualifiedStorageUri() CloudBlob.getQualifiedUri() CloudBlob.getServiceClient() CloudBlob.getSnapshotID() CloudBlob.getSnapshotQualifiedStorageUri() CloudBlob.getSnapshotQualifiedUri() CloudBlob.getStorageUri() CloudBlob.getStreamMinimumReadSizeInBytes() CloudBlob.getStreamWriteSizeInBytes() CloudBlob.getTransformedAddress(final OperationContext opContext) CloudBlob.getUri() CloudBlob.isSnapshot() CloudBlob.openInputStream() CloudBlob.openInputStream(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.openInputStream(final long offset, final Long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.parent CloudBlob.releaseLease(final AccessCondition accessCondition) CloudBlob.releaseLease(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.renewLease(final AccessCondition accessCondition) CloudBlob.renewLease(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.setContainer(final CloudBlobContainer container) CloudBlob.setMetadata(final HashMap<String, String> metadata) CloudBlob.setProperties(final BlobProperties properties) CloudBlob.setSnapshotID(final String snapshotID) CloudBlob.setStorageUri(final StorageUri storageUri) CloudBlob.setStreamMinimumReadSizeInBytes(final int minimumReadSize) CloudBlob.startCopy(final URI source) CloudBlob.startCopy(final URI source, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.startCopy(final URI source, final String blobTierString, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.startCopy(final URI source, String contentMd5, boolean syncCopy, final String blobTierString, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.startCopy(final URI source, String contentMd5, boolean syncCopy, final String blobTierString, final RehydratePriority rehydratePriority, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.startCopyImpl(final URI source, final String contentMd5, final boolean syncCopy, final boolean incrementalCopy, final String blobTierString, final RehydratePriority rehydratePriority, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, final BlobRequestOptions options) CloudBlob.streamMinimumReadSizeInBytes CloudBlob.streamWriteSizeInBytes CloudBlob.undelete() CloudBlob.undelete(BlobRequestOptions options, OperationContext opContext) CloudBlob.updateEtagAndLastModifiedFromResponse(HttpURLConnection request) CloudBlob.updateLengthFromResponse(HttpURLConnection request) CloudBlob.uploadFromByteArray(final byte[] buffer, final int offset, final int length) CloudBlob.uploadFromByteArray(final byte[] buffer, final int offset, final int length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.uploadFromFile(final String path) CloudBlob.uploadFromFile(final String path, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.uploadMetadata() CloudBlob.uploadMetadata(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.uploadProperties() CloudBlob.uploadProperties(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) CloudBlob.validateCPKHeaders(StorageRequest<CloudBlobClient, T, R> request, BlobRequestOptions options, boolean upload)

Constructor Details

CloudAppendBlob

public CloudAppendBlob(final CloudAppendBlob otherBlob)

Creates an instance of the class by copying values from another append blob.

Parameters:

otherBlob - A CloudAppendBlob object which represents the append blob to copy.

CloudAppendBlob

public CloudAppendBlob(final StorageUri blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI and storage service client.

Parameters:

blobAbsoluteUri - A StorageUri object which represents the absolute URI to the blob.

Throws:

StorageException - If a storage service error occurred.

CloudAppendBlob

public CloudAppendBlob(final StorageUri blobAbsoluteUri, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute StorageUri and credentials.

Parameters:

blobAbsoluteUri - A StorageUri object that represents the absolute URI to the blob.
credentials - A StorageCredentials object used to authenticate access.

Throws:

StorageException - If a storage service error occurred.

CloudAppendBlob

public CloudAppendBlob(final StorageUri blobAbsoluteUri, final String snapshotID, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute StorageUri, snapshot ID, and credentials.

Parameters:

blobAbsoluteUri - A StorageUri 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.

Throws:

StorageException - If a storage service error occurred.

CloudAppendBlob

public CloudAppendBlob(final URI blobAbsoluteUri)

Creates an instance of the class using the specified absolute URI and storage service client.

Parameters:

blobAbsoluteUri - A java.net.URI object which represents the absolute URI to the blob.

Throws:

StorageException - If a storage service error occurred.

CloudAppendBlob

public CloudAppendBlob(final URI blobAbsoluteUri, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute URI and credentials.

Parameters:

blobAbsoluteUri - A java.net.URI object that represents the absolute URI to the blob.
credentials - A StorageCredentials object used to authenticate access.

Throws:

StorageException - If a storage service error occurred.

CloudAppendBlob

public CloudAppendBlob(final URI blobAbsoluteUri, final String snapshotID, final StorageCredentials credentials)

Creates an instance of the class using the specified absolute URI, snapshot ID, and credentials.

Parameters:

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.

Throws:

StorageException - If a storage service error occurred.

CloudAppendBlob

protected CloudAppendBlob(String blobName, String snapshotID, CloudBlobContainer container)

Creates an instance of the class using the specified type, name, snapshot ID, and container.

Parameters:

blobName - Name of the blob.
snapshotID - A String that represents the snapshot version, if applicable.
container - The reference to the parent container.

Throws:

URISyntaxException - If the resource URI is invalid.

Method Details

append

public void append(InputStream sourceStream, final long length)

Appends a stream to an append blob. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

sourceStream - A InputStream object providing the blob content to append.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.

Throws:

StorageException - If a storage service error occurred.
IOException - If an I/O exception occurred.

append

public void append(InputStream sourceStream, final long length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Appends a stream to an append blob. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

sourceStream - A InputStream object providing the blob content to append.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.
accessCondition - An AccessCondition object which 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 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.

Throws:

StorageException - If a storage service error occurred.
IOException - If an I/O exception occurred.

appendBlock

public Long appendBlock(final InputStream sourceStream, final long length)

Commits a new block of data to the end of the blob.

Parameters:

sourceStream - An InputStream object that represents the input stream to write to the append blob.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.

Returns:

The offset at which the block was appended.

Throws:

IOException - If an I/O exception occurred.
StorageException - If a storage service error occurred.

appendBlock

public Long appendBlock(final InputStream sourceStream, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Commits a new block of data to the end of the blob.

Parameters:

sourceStream - An InputStream object that represents the input stream to write to the Append blob.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.
accessCondition - An AccessCondition object which 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 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.

Returns:

The offset at which the block was appended.

Throws:

IOException - If an I/O exception occurred.
StorageException - If a storage service error occurred.

appendBlockFromURI

public Long appendBlockFromURI(final URI copySource, final Long offset, final Long length)

Appends a block, using the specified source URL.

Parameters:

copySource - The URI of the source data. It can point to any Azure Blob or File that is public or the URL can include a shared access signature.
offset - A long which represents the offset to use as the starting point for the source.
length - A Long which represents the number of bytes to copy or null to copy until the end of the blob.

Returns:

The offset at which the block was appended.

Throws:

StorageException - If a storage service error occurred.

appendBlockFromURI

public Long appendBlockFromURI(final URI copySource, final Long offset, final Long length, String md5, final AccessCondition accessCondition, final AccessCondition sourceAccessCondition, BlobRequestOptions options, OperationContext opContext)

Appends a block, using the specified source URL.

Parameters:

copySource - The URI of the source data. It can point to any Azure Blob or File that is public or the URL can include a shared access signature.
offset - A long which represents the offset to use as the starting point for the source.
length - A Long which represents the number of bytes to copy or null to copy until the end of the blob.
md5 - A String which represents the MD5 caluclated for the range of bytes of the source.
accessCondition - An AccessCondition object which represents the access conditions for the blob.
sourceAccessCondition - An AccessCondition object which represents the access conditions for the source 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.

Returns:

The offset at which the block was appended.

Throws:

StorageException - If a storage service error occurred.

appendFromByteArray

public void appendFromByteArray(final byte[] buffer, final int offset, final int length)

Appends the contents of a byte array to an append blob.This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

buffer - A byte array which represents the data to append to the blob.
offset - A int which represents the offset of the byte array from which to start the data upload.
length - An int which represents the number of bytes to upload from the input buffer.

Throws:

StorageException - If a storage service error occurred.
IOException - If an I/O exception occurred.

appendFromByteArray

public void appendFromByteArray(final byte[] buffer, final int offset, final int length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Appends the contents of a byte array to an append blob.This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

buffer - A byte array which represents the data to append to the blob.
offset - A int which represents the offset of the byte array from which to start the data upload.
length - An int which represents the number of bytes to upload from the input buffer.
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.

Throws:

StorageException - If a storage service error occurred.
IOException - If an I/O exception occurred.

appendFromFile

public void appendFromFile(final String path)

Appends a file to an append blob. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

path - A String which represents the path to the file to be appended.

Throws:

StorageException - If a storage service error occurred.
IOException - If an I/O exception occurred.

appendFromFile

public void appendFromFile(final String path, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Appends a file to an append blob. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

path - A String which represents the path to the file to be appended.
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.

Throws:

StorageException - If a storage service error occurred.
IOException - If an I/O exception occurred.

appendText

public void appendText(final String content)

Appends a string of text to an append blob using the platform's default encoding. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

content - A String which represents the content that will be appended to the blob.

Throws:

StorageException - If a storage service error occurred.
IOException - If an I/O exception occurred.

appendText

public void appendText(final String content, final String charsetName, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Appends a string of text to an append blob using the specified encoding. This API should be used strictly in a single writer scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which does not work in a multiple writer scenario.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

content - A String which represents the content that will be appended 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.

Throws:

StorageException - If a storage service error occurred.
IOException - If an I/O exception occurred.

createOrReplace

public void createOrReplace()

Creates an empty append blob. If the blob already exists, this will replace it.

To avoid overwriting and instead throw an error, please use the createOrReplace(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) overload with the appropriate AccessCondition.

Throws:

StorageException - If a storage service error occurred.

createOrReplace

public void createOrReplace(final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Creates an append blob using the specified request options and operation context. If the blob already exists, this will replace it.

To avoid overwriting and instead throw an error, please pass in an AccessCondition generated using generateIfNotExistsCondition().

Parameters:

accessCondition - An AccessCondition object which 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 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.

Throws:

StorageException - If a storage service error occurred.

openWriteExisting

public BlobOutputStream openWriteExisting()

Opens an output stream object to write data to the append blob. The append blob must already exist and will be appended to.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

openWriteExisting

public BlobOutputStream openWriteExisting(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Opens an output stream object to write data to the append blob, using the specified lease ID, request options and operation context. The append blob must already exist and will be appended to.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

accessCondition - An AccessCondition object which 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 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.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

openWriteNew

public BlobOutputStream openWriteNew()

Opens an output stream object to write data to the append blob. The append blob does not need to yet exist. If the blob already exists, this will replace it.

To avoid overwriting and instead throw an error, please use the openWriteNew(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext) overload with the appropriate AccessCondition.

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

openWriteNew

public BlobOutputStream openWriteNew(AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Opens an output stream object to write data to the append blob, using the specified lease ID, request options and operation context. The append blob does not need to yet exist. If the blob already exists, this will replace it.

To avoid overwriting and instead throw an error, please pass in an AccessCondition generated using generateIfNotExistsCondition().

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

accessCondition - An AccessCondition object which 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 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.

Returns:

A BlobOutputStream object used to write data to the blob.

Throws:

StorageException - If a storage service error occurred.

setStreamWriteSizeInBytes

public void setStreamWriteSizeInBytes(final int streamWriteSizeInBytes)

Sets the number of bytes to buffer when writing to a BlobOutputStream.

Parameters:

streamWriteSizeInBytes - An int which represents the maximum block size, in bytes, for writing to an append blob while using a BlobOutputStream object, ranging from 16 KB to 4 MB, inclusive.

Throws:

IllegalArgumentException - If streamWriteSizeInBytes is less than 16 KB or greater than 4 MB.

startCopy

public final String startCopy(final CloudAppendBlob sourceBlob)

Requests the service to start copying a append blob's contents, properties, and metadata to a new append blob.

Parameters:

sourceBlob - A CloudAppendBlob object that represents the source blob to copy.

Returns:

A String which represents the copy ID associated with the copy operation.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

startCopy

public final String startCopy(final CloudAppendBlob sourceBlob, final AccessCondition sourceAccessCondition, final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)

Requests the service to start copying a append blob's contents, properties, and metadata to a new append blob, using the specified access conditions, lease ID, request options, and operation context.

Parameters:

sourceBlob - A CloudAppendBlob 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.

Returns:

A String which represents the copy ID associated with the copy operation.

Throws:

StorageException - If a storage service error occurred.
URISyntaxException

upload

public void upload(final InputStream sourceStream, final long length)

Uploads the source stream data to the append blob. If the blob already exists on the service, it will be overwritten.

If you want to append data to an already existing blob, please see appendBlock(final InputStream sourceStream, final long length).

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

sourceStream - An InputStream object to read from.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.

Throws:

IOException - If an I/O exception occurred.
StorageException - If a storage service error occurred.

upload

public void upload(final InputStream sourceStream, final long length, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Uploads the source stream data to the append blob using the specified lease ID, request options, and operation context. If the blob already exists on the service, it will be overwritten.

If you want to append data to an already existing blob, please see appendBlock(final InputStream sourceStream, final long length).

If you are doing writes in a single writer scenario, please look at setAbsorbConditionalErrorsOnRetry(final Boolean absorbConditionalErrorsOnRetry) and see if setting this flag to is acceptable for you.

Parameters:

sourceStream - An InputStream object to read from.
length - A long which represents the length, in bytes, of the stream data, or -1 if unknown.
accessCondition - An AccessCondition object which 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 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.

Throws:

IOException - If an I/O exception occurred.
StorageException - If a storage service error occurred.

Applies to