Class

GioOutputStream

Description [src]

abstract class Gio.OutputStream : GObject.Object
{
  /* No available fields */
}

GOutputStream is a base class for implementing streaming output.

It has functions to write to a stream (g_output_stream_write()), to close a stream (g_output_stream_close()) and to flush pending writes (g_output_stream_flush()).

To copy the content of an input stream to an output stream without manually handling the reads and writes, use g_output_stream_splice().

See the documentation for GIOStream for details of thread safety of streaming APIs.

All of these functions have async variants too.

All classes derived from GOutputStream should implement synchronous writing, splicing, flushing and closing streams, but may implement asynchronous versions.

Ancestors

Instance methods

g_output_stream_clear_pending

Clears the pending flag on stream.

g_output_stream_close

Closes the stream, releasing resources related to it.

g_output_stream_close_async

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished callback will be called. You can then call g_output_stream_close_finish() to get the result of the operation.

g_output_stream_close_finish

Closes an output stream.

g_output_stream_flush

Forces a write of all user-space buffered data for the given stream. Will block during the operation. Closing the stream will implicitly cause a flush.

g_output_stream_flush_async

Forces an asynchronous write of all user-space buffered data for the given stream. For behaviour details see g_output_stream_flush().

g_output_stream_flush_finish

Finishes flushing an output stream.

g_output_stream_has_pending

Checks if an output stream has pending actions.

g_output_stream_is_closed

Checks if an output stream has already been closed.

g_output_stream_is_closing

Checks if an output stream is being closed. This can be used inside e.g. a flush implementation to see if the flush (or other i/o operation) is called from within the closing operation.

since: 2.24

g_output_stream_printf

This is a utility function around g_output_stream_write_all(). It uses g_strdup_vprintf() to turn format and @… into a string that is then written to stream.

since: 2.40

g_output_stream_set_pending

Sets stream to have actions pending. If the pending flag is already set or stream is closed, it will return FALSE and set error.

g_output_stream_splice

Splices an input stream into an output stream.

g_output_stream_splice_async

Splices a stream asynchronously. When the operation is finished callback will be called. You can then call g_output_stream_splice_finish() to get the result of the operation.

g_output_stream_splice_finish

Finishes an asynchronous stream splice operation.

g_output_stream_vprintf

This is a utility function around g_output_stream_write_all(). It uses g_strdup_vprintf() to turn format and args into a string that is then written to stream.

since: 2.40

g_output_stream_write

Tries to write count bytes from buffer into the stream. Will block during the operation.

g_output_stream_write_all

Tries to write count bytes from buffer into the stream. Will block during the operation.

g_output_stream_write_all_async

Request an asynchronous write of count bytes from buffer into the stream. When the operation is finished callback will be called. You can then call g_output_stream_write_all_finish() to get the result of the operation.

since: 2.44

g_output_stream_write_all_finish

Finishes an asynchronous stream write operation started with g_output_stream_write_all_async().

since: 2.44

g_output_stream_write_async

Request an asynchronous write of count bytes from buffer into the stream. When the operation is finished callback will be called. You can then call g_output_stream_write_finish() to get the result of the operation.

g_output_stream_write_bytes

A wrapper function for g_output_stream_write() which takes a GBytes as input. This can be more convenient for use by language bindings or in other cases where the refcounted nature of GBytes is helpful over a bare pointer interface.

g_output_stream_write_bytes_async

This function is similar to g_output_stream_write_async(), but takes a GBytes as input. Due to the refcounted nature of GBytes, this allows the stream to avoid taking a copy of the data.

g_output_stream_write_bytes_finish

Finishes a stream write-from-GBytes operation.

g_output_stream_write_finish

Finishes a stream write operation.

g_output_stream_writev

Tries to write the bytes contained in the n_vectors vectors into the stream. Will block during the operation.

since: 2.60

g_output_stream_writev_all

Tries to write the bytes contained in the n_vectors vectors into the stream. Will block during the operation.

since: 2.60

g_output_stream_writev_all_async

Request an asynchronous write of the bytes contained in the n_vectors vectors into the stream. When the operation is finished callback will be called. You can then call g_output_stream_writev_all_finish() to get the result of the operation.

since: 2.60

g_output_stream_writev_all_finish

Finishes an asynchronous stream write operation started with g_output_stream_writev_all_async().

since: 2.60

g_output_stream_writev_async

Request an asynchronous write of the bytes contained in n_vectors vectors into the stream. When the operation is finished callback will be called. You can then call g_output_stream_writev_finish() to get the result of the operation.

since: 2.60

g_output_stream_writev_finish

Finishes a stream writev operation.

since: 2.60

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

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.

Class structure

struct GioOutputStreamClass {
  GObjectClass parent_class;
  gssize (* write_fn) (
    GOutputStream* stream,
    void* buffer,
    gsize count,
    GCancellable* cancellable,
    GError** error
  );
  gssize (* splice) (
    GOutputStream* stream,
    GInputStream* source,
    GOutputStreamSpliceFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  gboolean (* flush) (
    GOutputStream* stream,
    GCancellable* cancellable,
    GError** error
  );
  gboolean (* close_fn) (
    GOutputStream* stream,
    GCancellable* cancellable,
    GError** error
  );
  void (* write_async) (
    GOutputStream* stream,
    void* buffer,
    gsize count,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gssize (* write_finish) (
    GOutputStream* stream,
    GAsyncResult* result,
    GError** error
  );
  void (* splice_async) (
    GOutputStream* stream,
    GInputStream* source,
    GOutputStreamSpliceFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gssize (* splice_finish) (
    GOutputStream* stream,
    GAsyncResult* result,
    GError** error
  );
  void (* flush_async) (
    GOutputStream* stream,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* flush_finish) (
    GOutputStream* stream,
    GAsyncResult* result,
    GError** error
  );
  void (* close_async) (
    GOutputStream* stream,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* close_finish) (
    GOutputStream* stream,
    GAsyncResult* result,
    GError** error
  );
  gboolean (* writev_fn) (
    GOutputStream* stream,
    const GOutputVector* vectors,
    gsize n_vectors,
    gsize* bytes_written,
    GCancellable* cancellable,
    GError** error
  );
  void (* writev_async) (
    GOutputStream* stream,
    const GOutputVector* vectors,
    gsize n_vectors,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* writev_finish) (
    GOutputStream* stream,
    GAsyncResult* result,
    gsize* bytes_written,
    GError** error
  );
  void (* _g_reserved4) (
void
  );
  void (* _g_reserved5) (
void
  );
  void (* _g_reserved6) (
void
  );
  void (* _g_reserved7) (
void
  );
  void (* _g_reserved8) (
void
  );
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.

write_fn: gssize (* write_fn) ( GOutputStream* stream, void* buffer, gsize count, GCancellable* cancellable, GError** error )

No description available.

splice: gssize (* splice) ( GOutputStream* stream, GInputStream* source, GOutputStreamSpliceFlags flags, GCancellable* cancellable, GError** error )

No description available.

flush: gboolean (* flush) ( GOutputStream* stream, GCancellable* cancellable, GError** error )

No description available.

close_fn: gboolean (* close_fn) ( GOutputStream* stream, GCancellable* cancellable, GError** error )

No description available.

write_async: void (* write_async) ( GOutputStream* stream, void* buffer, gsize count, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

write_finish: gssize (* write_finish) ( GOutputStream* stream, GAsyncResult* result, GError** error )

No description available.

splice_async: void (* splice_async) ( GOutputStream* stream, GInputStream* source, GOutputStreamSpliceFlags flags, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

splice_finish: gssize (* splice_finish) ( GOutputStream* stream, GAsyncResult* result, GError** error )

No description available.

flush_async: void (* flush_async) ( GOutputStream* stream, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

flush_finish: gboolean (* flush_finish) ( GOutputStream* stream, GAsyncResult* result, GError** error )

No description available.

close_async: void (* close_async) ( GOutputStream* stream, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

close_finish: gboolean (* close_finish) ( GOutputStream* stream, GAsyncResult* result, GError** error )

No description available.

writev_fn: gboolean (* writev_fn) ( GOutputStream* stream, const GOutputVector* vectors, gsize n_vectors, gsize* bytes_written, GCancellable* cancellable, GError** error )

No description available.

writev_async: void (* writev_async) ( GOutputStream* stream, const GOutputVector* vectors, gsize n_vectors, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

writev_finish: gboolean (* writev_finish) ( GOutputStream* stream, GAsyncResult* result, gsize* bytes_written, GError** error )

No description available.

_g_reserved4: void (* _g_reserved4) ( void )

No description available.

_g_reserved5: void (* _g_reserved5) ( void )

No description available.

_g_reserved6: void (* _g_reserved6) ( void )

No description available.

_g_reserved7: void (* _g_reserved7) ( void )

No description available.

_g_reserved8: void (* _g_reserved8) ( void )

No description available.

Virtual methods

Gio.OutputStreamClass.close_async

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished callback will be called. You can then call g_output_stream_close_finish() to get the result of the operation.

Gio.OutputStreamClass.close_finish

Closes an output stream.

Gio.OutputStreamClass.close_fn
No description available.

Gio.OutputStreamClass.flush

Forces a write of all user-space buffered data for the given stream. Will block during the operation. Closing the stream will implicitly cause a flush.

Gio.OutputStreamClass.flush_async

Forces an asynchronous write of all user-space buffered data for the given stream. For behaviour details see g_output_stream_flush().

Gio.OutputStreamClass.flush_finish

Finishes flushing an output stream.

Gio.OutputStreamClass.splice

Splices an input stream into an output stream.

Gio.OutputStreamClass.splice_async

Splices a stream asynchronously. When the operation is finished callback will be called. You can then call g_output_stream_splice_finish() to get the result of the operation.

Gio.OutputStreamClass.splice_finish

Finishes an asynchronous stream splice operation.

Gio.OutputStreamClass.write_async

Request an asynchronous write of count bytes from buffer into the stream. When the operation is finished callback will be called. You can then call g_output_stream_write_finish() to get the result of the operation.

Gio.OutputStreamClass.write_finish

Finishes a stream write operation.

Gio.OutputStreamClass.write_fn

Tries to write count bytes from buffer into the stream. Will block during the operation.

Gio.OutputStreamClass.writev_async

Request an asynchronous write of the bytes contained in n_vectors vectors into the stream. When the operation is finished callback will be called. You can then call g_output_stream_writev_finish() to get the result of the operation.

since: 2.60

Gio.OutputStreamClass.writev_finish

Finishes a stream writev operation.

since: 2.60

Gio.OutputStreamClass.writev_fn

Tries to write the bytes contained in the n_vectors vectors into the stream. Will block during the operation.

since: 2.60