GData.DownloadStream

g GData.DownloadStream GData.DownloadStream GObject.GInterface GObject.GInterface Gio.Seekable Gio.Seekable GObject.GInterface->Gio.Seekable GObject.Object GObject.Object Gio.InputStream Gio.InputStream GObject.Object->Gio.InputStream Gio.InputStream->GData.DownloadStream Gio.Seekable->GData.DownloadStream

Subclasses:

None

Methods

Inherited:

Gio.InputStream (19), GObject.Object (37), Gio.Seekable (5)

Structs:

GObject.ObjectClass (5)

class

new (service, domain, download_uri, cancellable)

get_authorization_domain ()

get_cancellable ()

get_content_length ()

get_content_type ()

get_download_uri ()

get_service ()

Virtual Methods

Inherited:

Gio.InputStream (9), GObject.Object (7), Gio.Seekable (5)

Properties

Name

Type

Flags

Short Description

authorization-domain

GData.AuthorizationDomain

r/w/co

The authorization domain for the download.

cancellable

Gio.Cancellable

r/w/co

An optional cancellable used to cancel the entire download operation.

content-length

r

The length (in bytes) of the file being downloaded.

content-type

str

r

The content type of the file being downloaded.

download-uri

str

r/w/co

The URI of the file to download.

service

GData.Service

r/w/co

The service which is used to authorize the download.

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

Gio.InputStream

r

Class Details

class GData.DownloadStream(**kwargs)
Bases:

Gio.InputStream, Gio.Seekable

Abstract:

No

Structure:

GData.DownloadStreamClass

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:
Returns:

a new Gio.InputStream, or None; unref with GObject.Object.unref()

Return type:

Gio.InputStream

Creates a new GData.DownloadStream, allowing a file to be downloaded from a GLib.Data service using standard Gio.InputStream API.

As well as the standard GIO errors, calls to the Gio.InputStream API on a GData.DownloadStream can also return any relevant specific error from GData.ServiceError, or GData.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 using Gio.Cancellable.cancel(). In this case, any ongoing network activity will be stopped, and any pending or future calls to Gio.InputStream API on the GData.DownloadStream will return Gio.IOErrorEnum.CANCELLED. Note that the Gio.Cancellable objects which can be passed to individual Gio.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, or None

Return type:

GData.AuthorizationDomain or None

Gets the authorization domain used to authorize the download, as passed to GData.DownloadStream.new(). It may be None 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:

Gio.Cancellable

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:

int

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()
Returns:

the content type of the file being downloaded, or None

Return type:

str

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:

str

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:

GData.Service

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:

GData.AuthorizationDomain

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The authorization domain for the download, against which the GData.Service :authorizer for the GData.DownloadStream :service should be authorized. This may be None if authorization is not needed for the download.

New in version 0.9.0.

GData.DownloadStream.props.cancellable
Name:

cancellable

Type:

Gio.Cancellable

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

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. to GData.DownloadStream.new()), one will be created internally and can be retrieved using GData.DownloadStream.get_cancellable() and used to cancel the download operation with Gio.Cancellable.cancel() just as if it was passed to GData.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 to Gio.InputStream API on the GData.DownloadStream will return Gio.IOErrorEnum.CANCELLED. Note that the Gio.Cancellable objects which can be passed to individual Gio.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 GData.DownloadStream :cancellable.

New in version 0.8.0.

GData.DownloadStream.props.content_length
Name:

content-length

Type:

Default Value:

-1

Flags:

READABLE

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 the GData.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 the GData.DownloadStream as appropriate.

New in version 0.5.0.

GData.DownloadStream.props.content_type
Name:

content-type

Type:

str

Default Value:

None

Flags:

READABLE

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 the GData.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 the GData.DownloadStream as appropriate.

New in version 0.5.0.

GData.DownloadStream.props.download_uri
Name:

download-uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The URI of the file to download. This must be HTTPS.

New in version 0.5.0.

GData.DownloadStream.props.service
Name:

service

Type:

GData.Service

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The service which is used to authorize the download, and to which the download relates.

New in version 0.5.0.