Google API Client Library for .NET  1.10.0
Classes | Public Member Functions | Public Attributes | Properties | Events | List of all members
Google.Apis.Download.MediaDownloader Class Reference

A media downloader implementation which handles media downloads. It supports downloading a media content in chunks, when each chunk size is defined by ChunkSize. More...

Inheritance diagram for Google.Apis.Download.MediaDownloader:
Google.Apis.Download.IMediaDownloader

Public Member Functions

 MediaDownloader (IClientService service)
 Constructs a new downloader with the given client service. More...
 
IDownloadProgress Download (string url, Stream stream)
 Downloads synchronously the given URL to the given stream. More...
 
async Task< IDownloadProgressDownloadAsync (string url, Stream stream)
 Downloads asynchronously the given URL to the given stream. More...
 
async Task< IDownloadProgressDownloadAsync (string url, Stream stream, CancellationToken cancellationToken)
 Downloads asynchronously the given URL to the given stream. This download method supports a cancellation token to cancel a request before it was completed. More...
 

Public Attributes

const int MaximumChunkSize = 10 * MB
 Maximum chunk size. Default value is 10*MB. More...
 

Properties

int ChunkSize [get, set]
 Gets or sets the size of each chunk to download from the server. Chunks can't be set to be a value bigger than MaximumChunkSize. Default value is MaximumChunkSize. More...
 
- Properties inherited from Google.Apis.Download.IMediaDownloader
int ChunkSize [get, set]
 Gets or sets the chunk size to download, it defines the size of each part. More...
 

Events

Action< IDownloadProgressProgressChanged
 
- Events inherited from Google.Apis.Download.IMediaDownloader
Action< IDownloadProgressProgressChanged
 An event which notifies when the download status has been changed. More...
 

Detailed Description

A media downloader implementation which handles media downloads. It supports downloading a media content in chunks, when each chunk size is defined by ChunkSize.

Constructor & Destructor Documentation

Google.Apis.Download.MediaDownloader.MediaDownloader ( IClientService  service)
inline

Constructs a new downloader with the given client service.

Member Function Documentation

IDownloadProgress Google.Apis.Download.MediaDownloader.Download ( string  url,
Stream  stream 
)
inline

Downloads synchronously the given URL to the given stream.

Implements Google.Apis.Download.IMediaDownloader.

async Task<IDownloadProgress> Google.Apis.Download.MediaDownloader.DownloadAsync ( string  url,
Stream  stream 
)
inline

Downloads asynchronously the given URL to the given stream.

Implements Google.Apis.Download.IMediaDownloader.

async Task<IDownloadProgress> Google.Apis.Download.MediaDownloader.DownloadAsync ( string  url,
Stream  stream,
CancellationToken  cancellationToken 
)
inline

Downloads asynchronously the given URL to the given stream. This download method supports a cancellation token to cancel a request before it was completed.

In case the download fails IDownloadProgress.Exception will contain the exception that cause the failure. The only exception which will be thrown is System.Threading.Tasks.TaskCanceledException which indicates that the task was canceled.

Implements Google.Apis.Download.IMediaDownloader.

Member Data Documentation

const int Google.Apis.Download.MediaDownloader.MaximumChunkSize = 10 * MB

Maximum chunk size. Default value is 10*MB.

Property Documentation

int Google.Apis.Download.MediaDownloader.ChunkSize
getset

Gets or sets the size of each chunk to download from the server. Chunks can't be set to be a value bigger than MaximumChunkSize. Default value is MaximumChunkSize.


The documentation for this class was generated from the following file: