GDataDownloadStream

## GDataDownloadStream GDataDownloadStream — GData download stream object |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <gdata/gdata-download-stream.h>

                        GDataDownloadStream;
                        GDataDownloadStreamClass;
    GInputStream *      gdata_download_stream_new           (GDataService *service,
                                                             const gchar *download_uri);
    GDataService *      gdata_download_stream_get_service   (GDataDownloadStream *self);
    const gchar *       gdata_download_stream_get_download_uri
                                                            (GDataDownloadStream *self);
    const gchar *       gdata_download_stream_get_content_type
                                                            (GDataDownloadStream *self);
    gssize              gdata_download_stream_get_content_length
                                                            (GDataDownloadStream *self);

## Object Hierarchy

      GObject
       +----GInputStream
             +----GDataDownloadStream

## Implemented Interfaces

GDataDownloadStream implements GSeekable.

## Properties

      "content-length"           glong                 : Read
      "content-type"             gchar*                : Read
      "download-uri"             gchar*                : Read / Write / Construct Only
      "service"                  GDataService*         : Read / Write / Construct Only

## Description

GDataDownloadStream is a GInputStream subclass to allow downloading of files from GData services with authentication from a GDataService.

Once a GDataDownloadStream is instantiated with `gdata_download_stream_new()`, the standard GInputStream API can be used on the stream to download the file. Network communication may not actually begin until the first call to `g_input_stream_read()`, so having a GDataDownloadStream around is no guarantee that the file is being downloaded.

The content type and length of the file being downloaded are made available through "content-type" and "content-length" as soon as the appropriate data is received from the server. Connect to the "notify" `content-type` and `content-length` details to be notified as soon as the data is available.

## Details

### GDataDownloadStream

    typedef struct _GDataDownloadStream GDataDownloadStream;

All the fields in the GDataDownloadStream structure are private and should never be accessed directly.

Since 0.5.0

### GDataDownloadStreamClass

    typedef struct {
    } GDataDownloadStreamClass;

All the fields in the GDataDownloadStreamClass structure are private and should never be accessed directly.

Since 0.5.0

### gdata_download_stream_new ()

    GInputStream *      gdata_download_stream_new           (GDataService *service,
                                                             const gchar *download_uri);

Creates a new GDataDownloadStream, allowing a file to be downloaded from a GData service using standard GInputStream API.

As well as the standard GIO errors, calls to the GInputStream API on a GDataDownloadStream can also return any relevant specific error from GDataServiceError, or `GDATA_SERVICE_ERROR_PROTOCOL_ERROR` in the general case.

`service` : | a GDataService
`download_uri` : | the URI to download
Returns : | a new GInputStream, or `NULL`; unref with `g_object_unref()`

Since 0.5.0

### gdata_download_stream_get_service ()

    GDataService *      gdata_download_stream_get_service   (GDataDownloadStream *self);

Gets the service used to authenticate the download, as passed to `gdata_download_stream_new()`.

`self` : | a GDataDownloadStream
Returns : | the GDataService used to authenticate the download. [transfer none]

Since 0.5.0

### gdata_download_stream_get_download_uri ()

    const gchar *       gdata_download_stream_get_download_uri
                                                            (GDataDownloadStream *self);

Gets the URI of the file being downloaded, as passed to `gdata_download_stream_new()`.

`self` : | a GDataDownloadStream
Returns : | the URI of the file being downloaded

Since 0.5.0

### gdata_download_stream_get_content_type ()

    const gchar *       gdata_download_stream_get_content_type
                                                            (GDataDownloadStream *self);

Gets the content type of the file being downloaded. If the `Content-Type` header has not yet been received, `NULL` will be returned.

`self` : | a GDataDownloadStream
Returns : | the content type of the file being downloaded, or `NULL`

Since 0.5.0

### gdata_download_stream_get_content_length ()

    gssize              gdata_download_stream_get_content_length
                                                            (GDataDownloadStream *self);

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.

`self` : | a GDataDownloadStream
Returns : | the content length of the file being downloaded, or `-1`

Since 0.5.0

## Property Details

### The `"content-length"` property

      "content-length"           glong                 : Read

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

Allowed values: >= -1

Default value: -1

Since 0.5.0

### The `"content-type"` property

      "content-type"             gchar*                : Read

The content type of the file being downloaded.

Default value: NULL

Since 0.5.0

### The `"download-uri"` property

      "download-uri"             gchar*                : Read / Write / Construct Only

The URI of the file to download.

Default value: NULL

Since 0.5.0

### The `"service"` property

      "service"                  GDataService*         : Read / Write / Construct Only

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

Since 0.5.0