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.DownloadStream
structure 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.Service
domain (
GData.AuthorizationDomain
orNone
) – theGData.AuthorizationDomain
to authorize the download, orNone
download_uri (
str
) – the URI to download; this must be HTTPScancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
for 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.Data
service using standardGio.InputStream
API.As well as the standard GIO errors, calls to the
Gio.InputStream
API on aGData.DownloadStream
can also return any relevant specific error fromGData.ServiceError
, orGData.ServiceError.PROTOCOL_ERROR
in the general case.If a
Gio.Cancellable
is 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.InputStream
API on theGData.DownloadStream
will returnGio.IOErrorEnum.CANCELLED
. Note that theGio.Cancellable
objects which can be passed to individualGio.InputStream
operations 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.AuthorizationDomain
used to authorize the download, orNone
- Return type:
Gets the authorization domain used to authorize the download, as passed to
GData.DownloadStream.new
(). It may beNone
if authorization is not needed for the download.New in version 0.9.0.
- get_cancellable()¶
- Returns:
the
Gio.Cancellable
for the entire download operation- Return type:
Gets the
Gio.Cancellable
for 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-Length
header 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-Type
header has not yet been received,None
will 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.Service
used 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
:authorizer
for theGData.DownloadStream
:service
should be authorized. This may beNone
if 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.Cancellable
instance 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.InputStream
API on theGData.DownloadStream
will returnGio.IOErrorEnum.CANCELLED
. Note that theGio.Cancellable
objects which can be passed to individualGio.InputStream
operations 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
::notify
emissions) 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.DownloadStream
as 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
::notify
emissions) 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.DownloadStream
as 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.