GData.DownloadStream¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/co |
The authorization domain for the download. |
||
r/w/co |
An optional cancellable used to cancel the entire download operation. |
||
r |
The length (in bytes) of the file being downloaded. |
||
r |
The content type of the file being downloaded. |
||
r/w/co |
The URI of the file to download. |
||
r/w/co |
The service which is used to authorize the download. |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class GData.DownloadStream(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
All the fields in the
GData.DownloadStreamstructure are private and should never be accessed directly.New in version 0.5.0.
- classmethod new(service, domain, download_uri, cancellable)¶
- Parameters:
service (
GData.Service) – aGData.Servicedomain (
GData.AuthorizationDomainorNone) – theGData.AuthorizationDomainto authorize the download, orNonedownload_uri (
str) – the URI to download; this must be HTTPScancellable (
Gio.CancellableorNone) – aGio.Cancellablefor the entire download stream, orNone
- Returns:
a new
Gio.InputStream, orNone; unref withGObject.Object.unref()- Return type:
Creates a new
GData.DownloadStream, allowing a file to be downloaded from aGLib.Dataservice using standardGio.InputStreamAPI.As well as the standard GIO errors, calls to the
Gio.InputStreamAPI on aGData.DownloadStreamcan also return any relevant specific error fromGData.ServiceError, orGData.ServiceError.PROTOCOL_ERRORin the general case.If a
Gio.Cancellableis provided in cancellable, the download operation may be cancelled at any time from another thread usingGio.Cancellable.cancel(). In this case, any ongoing network activity will be stopped, and any pending or future calls toGio.InputStreamAPI on theGData.DownloadStreamwill returnGio.IOErrorEnum.CANCELLED. Note that theGio.Cancellableobjects which can be passed to individualGio.InputStreamoperations will not cancel the download operation proper if cancelled — they will merely cancel that API call. The only way to cancel the download operation completely is using this cancellable.New in version 0.9.0.
- get_authorization_domain()¶
- Returns:
the
GData.AuthorizationDomainused to authorize the download, orNone- Return type:
Gets the authorization domain used to authorize the download, as passed to
GData.DownloadStream.new(). It may beNoneif authorization is not needed for the download.New in version 0.9.0.
- get_cancellable()¶
- Returns:
the
Gio.Cancellablefor the entire download operation- Return type:
Gets the
Gio.Cancellablefor the entire download operation,GData.DownloadStream:cancellable.New in version 0.8.0.
- get_content_length()¶
- Returns:
the content length of the file being downloaded, or -1
- Return type:
Gets the length (in bytes) of the file being downloaded. If the
Content-Lengthheader has not yet been received from the server, -1 will be returned.New in version 0.5.0.
- get_content_type()¶
-
Gets the content type of the file being downloaded. If the
Content-Typeheader has not yet been received,Nonewill be returned.New in version 0.5.0.
- get_download_uri()¶
- Returns:
the URI of the file being downloaded
- Return type:
Gets the URI of the file being downloaded, as passed to
GData.DownloadStream.new().New in version 0.5.0.
- get_service()¶
- Returns:
the
GData.Serviceused to authorize the download- Return type:
Gets the service used to authorize the download, as passed to
GData.DownloadStream.new().New in version 0.5.0.
Property Details¶
- GData.DownloadStream.props.authorization_domain¶
- Name:
authorization-domain- Type:
- Default Value:
- Flags:
The authorization domain for the download, against which the
GData.Service:authorizerfor theGData.DownloadStream:serviceshould be authorized. This may beNoneif authorization is not needed for the download.New in version 0.9.0.
- GData.DownloadStream.props.cancellable¶
- Name:
cancellable- Type:
- Default Value:
- Flags:
An optional cancellable used to cancel the entire download operation. If a
Gio.Cancellableinstance isn’t provided for this property at construction time (i.e. toGData.DownloadStream.new()), one will be created internally and can be retrieved usingGData.DownloadStream.get_cancellable() and used to cancel the download operation withGio.Cancellable.cancel() just as if it was passed toGData.DownloadStream.new().If the download operation is cancelled using this
Gio.Cancellable, any ongoing network activity will be stopped, and any pending or future calls toGio.InputStreamAPI on theGData.DownloadStreamwill returnGio.IOErrorEnum.CANCELLED. Note that theGio.Cancellableobjects which can be passed to individualGio.InputStreamoperations will not cancel the download operation proper if cancelled — they will merely cancel that API call. The only way to cancel the download operation completely is usingGData.DownloadStream:cancellable.New in version 0.8.0.
- GData.DownloadStream.props.content_length¶
- Name:
content-length- Type:
- Default Value:
-1- Flags:
The length (in bytes) of the file being downloaded. This will initially be -1, and will be populated as soon as the appropriate header is received from the server. Its value will never change after this.
Note that change notifications for this property (
GObject.Object::notifyemissions) may be emitted in threads other than the one which created theGData.DownloadStream. It is the client’s responsibility to ensure that any notification signal handlers are either multi-thread safe or marshal the notification to the thread which owns theGData.DownloadStreamas appropriate.New in version 0.5.0.
- GData.DownloadStream.props.content_type¶
-
The content type of the file being downloaded. This will initially be
None, and will be populated as soon as the appropriate header is received from the server. Its value will never change after this.Note that change notifications for this property (
GObject.Object::notifyemissions) may be emitted in threads other than the one which created theGData.DownloadStream. It is the client’s responsibility to ensure that any notification signal handlers are either multi-thread safe or marshal the notification to the thread which owns theGData.DownloadStreamas appropriate.New in version 0.5.0.
- GData.DownloadStream.props.download_uri¶
- Name:
download-uri- Type:
- Default Value:
- Flags:
The URI of the file to download. This must be HTTPS.
New in version 0.5.0.
- GData.DownloadStream.props.service¶
- Name:
service- Type:
- Default Value:
- Flags:
The service which is used to authorize the download, and to which the download relates.
New in version 0.5.0.