Gio.FileOutputStream
Description: Reference for Gio.FileOutputStream

### Class

# GioFileOutputStream

since: 2.0

#### Description

    class Gio.FileOutputStream : Gio.OutputStream
      implements Gio.Seekable {
      /* No available fields */
    }

`GFileOutputStream` provides output streams that write their content to a file.

`GFileOutputStream` implements `GSeekable`, which allows the output stream to jump to arbitrary positions in the file and to truncate the file, provided the filesystem of the file supports these operations.

To find the position of a file output stream, use `g_seekable_tell()`. To find out if a file output stream supports seeking, use `g_seekable_can_seek()`.To position a file output stream, use `g_seekable_seek()`. To find out if a file output stream supports truncating, use `g_seekable_can_truncate()`. To truncate a file output stream, use `g_seekable_truncate()`.

Available since: 2.0

#### Ancestors

- GOutputStream
- GObject

#### Implements

- GSeekable

#### Instance methods

###### g_file_output_stream_get_etag

Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.

since: 2.0

###### g_file_output_stream_query_info

Queries a file output stream for the given `attributes`. This function blocks while querying the stream. For the asynchronous version of this function, see g_file_output_stream_query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with `G_IO_ERROR_PENDING`.

since: 2.0

###### g_file_output_stream_query_info_async

Asynchronously queries the `stream` for a `GFileInfo`. When completed, `callback` will be called with a `GAsyncResult` which can be used to finish the operation with g_file_output_stream_query_info_finish().

since: 2.0

###### g_file_output_stream_query_info_finish

Finalizes the asynchronous query started by g_file_output_stream_query_info_async().

since: 2.0

##### Methods inherited from GOutputStream (31)

Please see GOutputStream for a full list of methods.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GSeekable (5)

###### g_seekable_can_seek

Tests if the stream supports the `GSeekableIface`.

since: 2.0

###### g_seekable_can_truncate

Tests if the length of the stream can be adjusted with g_seekable_truncate().

since: 2.0

###### g_seekable_seek

Seeks in the stream by the given `offset`, modified by `type`.

since: 2.0

###### g_seekable_tell

Tells the current position within the stream.

since: 2.0

###### g_seekable_truncate

Sets the length of the stream to `offset`. If the stream was previously larger than `offset`, the extra data is discarded. If the stream was previously shorter than `offset`, it is extended with NUL (‘\0’) bytes.

since: 2.0

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0

#### Class structure

    struct GioFileOutputStreamClass {
      GOutputStreamClass parent_class;
      goffset (* tell) (
        GFileOutputStream* stream
      );
      gboolean (* can_seek) (
        GFileOutputStream* stream
      );
      gboolean (* seek) (
        GFileOutputStream* stream,
        goffset offset,
        GSeekType type,
        GCancellable* cancellable,
        GError** error
      );
      gboolean (* can_truncate) (
        GFileOutputStream* stream
      );
      gboolean (* truncate_fn) (
        GFileOutputStream* stream,
        goffset size,
        GCancellable* cancellable,
        GError** error
      );
      GFileInfo* (* query_info) (
        GFileOutputStream* stream,
        const char* attributes,
        GCancellable* cancellable,
        GError** error
      );
      void (* query_info_async) (
        GFileOutputStream* stream,
        const char* attributes,
        int io_priority,
        GCancellable* cancellable,
        GAsyncReadyCallback callback,
        gpointer user_data
      );
      GFileInfo* (* query_info_finish) (
        GFileOutputStream* stream,
        GAsyncResult* result,
        GError** error
      );
      char* (* get_etag) (
        GFileOutputStream* stream
      );
      void (* _g_reserved1) (
    void
      );
      void (* _g_reserved2) (
    void
      );
      void (* _g_reserved3) (
    void
      );
      void (* _g_reserved4) (
    void
      );
      void (* _g_reserved5) (
    void
      );

    }

No description available.

###### Class members

`parent_class: GOutputStreamClass`
  No description available.
`tell: goffset (* tell) ( GFileOutputStream* stream )`
  No description available.
`can_seek: gboolean (* can_seek) ( GFileOutputStream* stream )`
  No description available.
`seek: gboolean (* seek) ( GFileOutputStream* stream, goffset offset, GSeekType type, GCancellable* cancellable, GError** error )`
  No description available.
`can_truncate: gboolean (* can_truncate) ( GFileOutputStream* stream )`
  No description available.
`truncate_fn: gboolean (* truncate_fn) ( GFileOutputStream* stream, goffset size, GCancellable* cancellable, GError** error )`
  No description available.
`query_info: GFileInfo* (* query_info) ( GFileOutputStream* stream, const char* attributes, GCancellable* cancellable, GError** error )`
  No description available.
`query_info_async: void (* query_info_async) ( GFileOutputStream* stream, const char* attributes, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )`
  No description available.
`query_info_finish: GFileInfo* (* query_info_finish) ( GFileOutputStream* stream, GAsyncResult* result, GError** error )`
  No description available.
`get_etag: char* (* get_etag) ( GFileOutputStream* stream )`
  No description available.
`_g_reserved1: void (* _g_reserved1) ( void )`
  No description available.
`_g_reserved2: void (* _g_reserved2) ( void )`
  No description available.
`_g_reserved3: void (* _g_reserved3) ( void )`
  No description available.
`_g_reserved4: void (* _g_reserved4) ( void )`
  No description available.
`_g_reserved5: void (* _g_reserved5) ( void )`
  No description available.

#### Virtual methods

###### Gio.FileOutputStreamClass.can_seek

No description available.

since: 2.0

###### Gio.FileOutputStreamClass.can_truncate

No description available.

since: 2.0

###### Gio.FileOutputStreamClass.get_etag

Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.

since: 2.0

###### Gio.FileOutputStreamClass.query_info

Queries a file output stream for the given `attributes`. This function blocks while querying the stream. For the asynchronous version of this function, see g_file_output_stream_query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with `G_IO_ERROR_PENDING`.

since: 2.0

###### Gio.FileOutputStreamClass.query_info_async

Asynchronously queries the `stream` for a `GFileInfo`. When completed, `callback` will be called with a `GAsyncResult` which can be used to finish the operation with g_file_output_stream_query_info_finish().

since: 2.0

###### Gio.FileOutputStreamClass.query_info_finish

Finalizes the asynchronous query started by g_file_output_stream_query_info_async().

since: 2.0

###### Gio.FileOutputStreamClass.seek

No description available.

since: 2.0

###### Gio.FileOutputStreamClass.tell

No description available.

since: 2.0

###### Gio.FileOutputStreamClass.truncate_fn

No description available.

since: 2.0