Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GFileOutputStream

[21:7] extends: object

GFileOutputStream provides output streams that write their content to a file. GFileOutputStream implements [iface@Gio.Seekable], 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 [method@Gio.Seekable.tell]. To find out if a file output stream supports seeking, use [method@Gio.Seekable.can_seek].To position a file output stream, use [method@Gio.Seekable.seek]. To find out if a file output stream supports truncating, use [method@Gio.Seekable.can_truncate]. To truncate a file output stream, use [method@Gio.Seekable.truncate].

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GFileOutputStream (Handle = null)

    Creates a new FileOutputStream by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asOutputStream ()

    Wraps this handle as GOutputStream.

    • @r A GOutputStream object.
  • asSeekable ()

    Wraps this handle as GSeekable.

    • @r A GSeekable object.
  • 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.

    • @r the entity tag for the stream..
  • query_info (string attributes, object cancellable)

    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. Can fail if the stream was already closed (with @error being set to %G_IO_ERROR_CLOSED), the stream has pending operations (with @error being set to %G_IO_ERROR_PENDING), or if querying info is not supported for the stream's interface (with @error being set to %G_IO_ERROR_NOT_SUPPORTED). In all cases of failure, %NULL will be returned. If @cancellable is not %NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %NULL will be returned.

    • @p attributes is a file attribute query string..
    • @p cancellable is optional #GCancellable object, %NULL to ignore..
    • @r a #GFileInfo for the @stream, or %NULL on error..
  • query_info_async (string attributes, int io_priority, object cancellable, user_data)

    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(). For the synchronous version of this function, see g_file_output_stream_query_info().
    • @p attributes is a file attribute query string..
    • @p io_priority is the I/O priority of the request.
    • @p cancellable is optional #GCancellable object, %NULL to ignore..
    • @p callback is callback to call when the request is satisfied.
    • @p user_data is the data to pass to callback function.
    • @r None.
  • query_info_finish (object result)

    Finalizes the asynchronous query started by g_file_output_stream_query_info_async().

    • @p result is a #GAsyncResult..
    • @r A #GFileInfo for the finished query..