OutputStream
Object Hierarchy:
Description:
[
CCode ( type_id =
"g_output_stream_get_type ()" ) ]
public abstract class OutputStream :
Object
`GOutputStream` is a base class for implementing streaming output.
It has functions to write to a stream ([method@Gio.OutputStream.write]), to close a stream ([method@Gio.OutputStream.close]) and to flush
pending writes ([method@Gio.OutputStream.flush]).
To copy the content of an input stream to an output stream without manually handling the reads and writes, use [
method@Gio.OutputStream.splice].
See the documentation for [class@Gio.IOStream] 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.
Content:
Creation methods:
Methods:
- public void clear_pending ()
Clears the pending flag on this.
- public abstract bool close (Cancellable? cancellable = null) throws IOError
Closes the stream, releasing resources related to it.
- public virtual async bool close_async (int io_priority = DEFAULT, Cancellable? cancellable = null) throws IOError
Requests an asynchronous close of the stream, releasing resources
related to it.
- public virtual bool flush (Cancellable? cancellable = null) throws Error
Forces a write of all user-space buffered data for the given
this.
- public virtual async bool flush_async (int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error
Forces an asynchronous write of all user-space buffered data for the
given this.
- public bool has_pending ()
Checks if an output stream has pending actions.
- public bool is_closed ()
Checks if an output stream has already been closed.
- public bool is_closing ()
Checks if an output stream is being closed.
- public bool printf (out size_t bytes_written, Cancellable? cancellable, string format, ...) throws Error
- public bool set_pending () throws Error
Sets this to have actions pending.
- public virtual ssize_t splice (InputStream source, OutputStreamSpliceFlags flags, Cancellable? cancellable = null) throws IOError
Splices an input stream into an output stream.
- public virtual async ssize_t splice_async (InputStream source, OutputStreamSpliceFlags flags, int io_priority = DEFAULT, Cancellable? cancellable = null) throws IOError
Splices a stream asynchronously.
- public bool vprintf (out size_t bytes_written, Cancellable? cancellable, string format, va_list args) throws Error
- public abstract ssize_t write (uint8[] buffer, Cancellable? cancellable = null) throws IOError
Tries to write buffer.length bytes from buffer
into the stream.
- public bool write_all (uint8[] buffer, out size_t bytes_written, Cancellable? cancellable = null) throws IOError
Tries to write buffer.length bytes from buffer
into the stream.
- public async bool write_all_async (uint8[] buffer, int io_priority, Cancellable? cancellable, out size_t bytes_written) throws Error
Request an asynchronous write of buffer.length bytes from
buffer into the stream.
- public virtual async ssize_t write_async (uint8[]? buffer, int io_priority = DEFAULT, Cancellable? cancellable = null) throws IOError
Request an asynchronous write of buffer.length bytes from
buffer into the stream.
- public ssize_t write_bytes (Bytes bytes, Cancellable? cancellable = null) throws Error
A wrapper function for
write which takes a
Bytes as input.
- public async ssize_t write_bytes_async (Bytes bytes, int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error
- public virtual bool writev (OutputVector[] vectors, out size_t bytes_written, Cancellable? cancellable = null) throws Error
Tries to write the bytes contained in the vectors.length
vectors into the stream.
- public bool writev_all (OutputVector[] vectors, out size_t bytes_written, Cancellable? cancellable = null) throws Error
Tries to write the bytes contained in the vectors.length
vectors into the stream.
- public async bool writev_all_async (OutputVector[] vectors, int io_priority = DEFAULT, Cancellable? cancellable = null, out size_t bytes_written) throws Error
Request an asynchronous write of the bytes contained in the
vectors.length vectors into the stream.
- public virtual async bool writev_async (OutputVector[] vectors, int io_priority = DEFAULT, Cancellable? cancellable = null, out size_t bytes_written) throws Error
Request an asynchronous write of the bytes contained in
vectors.length vectors into the stream.
Inherited Members:
All known members inherited from class GLib.Object