[This topic is part of the Microsoft Azure Storage Client Library 1.7, which has been deprecated. See
Storage Client Library for the latest version.]
Ends an asynchronous operation to download the contents of a blob to a stream.
Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)
Usage
Visual Basic |
---|
Dim instance As CloudBlob
Dim asyncResult As IAsyncResult
instance.EndDownloadToStream(asyncResult) |
Syntax
Visual Basic |
---|
Public Sub EndDownloadToStream ( _
asyncResult As IAsyncResult _
) |
C# |
---|
public void EndDownloadToStream (
IAsyncResult asyncResult
) |
C++ |
---|
public:
void EndDownloadToStream (
IAsyncResult^ asyncResult
) |
Parameters
- asyncResult
Type: System.IAsyncResult
An IAsyncResult that references the pending asynchronous operation.
Example
The following code example downloads a text blob to a file stream in order to append it to a text file.
C# | Copy Code |
---|
static void DownloadBlobToStreamAsync(Uri blobEndpoint, string accountName, string accountKey)
{
// Create service client for credentialed access to the Blob service.
CloudBlobClient blobClient =
new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));
// Get a reference to a blob.
CloudBlob blob = blobClient.GetBlobReference("mycontainer/myblob.txt");
// Download the blob to a file stream.
FileStream stream = new FileStream("C:\\appendtofile.txt", FileMode.Append);
blob.BeginDownloadToStream(stream, DownloadBlobToStreamCallback, blob);
}
static void DownloadBlobToStreamCallback(IAsyncResult result)
{
CloudBlob blob = (CloudBlob)result.AsyncState;
// End the operation.
blob.EndDownloadToStream(result);
}
|
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Change History
See Also