gio.output_stream

Module for [OutputStream] class

Types 3

[gio.output_stream.OutputStream] is a base class for implementing streaming output.

It has functions to write to a stream ([gio.output_stream.OutputStream.write]), to close a stream ([gio.output_stream.OutputStream.close]) and to flush pending writes ([gio.output_stream.OutputStream.flush]).

To copy the content of an input stream to an output stream without manually handling the reads and writes, use [gio.output_stream.OutputStream.splice].

See the documentation for [gio.iostream.IOStream] for details of thread safety of streaming APIs.

All of these functions have async variants too.

All classes derived from [gio.output_stream.OutputStream] should implement synchronous writing, splicing, flushing and closing streams, but may implement asynchronous versions.

Methods
GType _gType() @property
OutputStream self()Returns `this`, for use in `with` statements.
OutputStreamGidBuilder builder()Get builder for [gio.output_stream.OutputStream] Returns: New builder object
void clearPending()Clears the pending flag on stream.
bool close(gio.cancellable.Cancellable cancellable = null)Closes the stream, releasing resources related to it.
void closeAsync(int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)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 [gio.output_stream.OutputStream.closeFinis...
bool closeFinish(gio.async_result.AsyncResult result)Closes an output stream.
bool flush(gio.cancellable.Cancellable cancellable = null)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.
void flushAsync(int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Forces an asynchronous write of all user-space buffered data for the given stream. For behaviour details see [gio.output_stream.OutputStream.flush].
bool flushFinish(gio.async_result.AsyncResult result)Finishes flushing an output stream.
bool hasPending()Checks if an output stream has pending actions. Returns: true if stream has pending actions.
bool isClosed()Checks if an output stream has already been closed. Returns: true if stream is closed. false otherwise.
bool isClosing()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. Returns: tr...
bool setPending()Sets stream to have actions pending. If the pending flag is already set or stream is closed, it will return false and set error. Returns: true if pending was previously unset and is now set. Throws...
ptrdiff_t splice(gio.input_stream.InputStream source, gio.types.OutputStreamSpliceFlags flags, gio.cancellable.Cancellable cancellable = null)Splices an input stream into an output stream.
void spliceAsync(gio.input_stream.InputStream source, gio.types.OutputStreamSpliceFlags flags, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Splices a stream asynchronously. When the operation is finished callback will be called. You can then call [gio.output_stream.OutputStream.spliceFinish] to get the result of the operation.
ptrdiff_t spliceFinish(gio.async_result.AsyncResult result)Finishes an asynchronous stream splice operation.
ptrdiff_t write(ubyte[] buffer, gio.cancellable.Cancellable cancellable = null)Tries to write count bytes from buffer into the stream. Will block during the operation.
bool writeAll(ubyte[] buffer, out size_t bytesWritten, gio.cancellable.Cancellable cancellable = null)Tries to write count bytes from buffer into the stream. Will block during the operation.
void writeAllAsync(ubyte[] buffer, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)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 [gio.output_stream.OutputStream.writeAllFinish] t...
bool writeAllFinish(gio.async_result.AsyncResult result, out size_t bytesWritten)Finishes an asynchronous stream write operation started with [gio.output_stream.OutputStream.writeAllAsync].
void writeAsync(ubyte[] buffer, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)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 [gio.output_stream.OutputStream.writeFinish] to g...
ptrdiff_t writeBytes(glib.bytes.Bytes bytes, gio.cancellable.Cancellable cancellable = null)A wrapper function for [gio.output_stream.OutputStream.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...
void writeBytesAsync(glib.bytes.Bytes bytes, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This function is similar to [gio.output_stream.OutputStream.writeAsync], but takes a #GBytes as input. Due to the refcounted nature of #GBytes, this allows the stream to avoid taking a copy of the...
ptrdiff_t writeBytesFinish(gio.async_result.AsyncResult result)Finishes a stream write-from-#GBytes operation.
ptrdiff_t writeFinish(gio.async_result.AsyncResult result)Finishes a stream write operation.
bool writev(gio.types.OutputVector[] vectors, out size_t bytesWritten, gio.cancellable.Cancellable cancellable = null)Tries to write the bytes contained in the n_vectors vectors into the stream. Will block during the operation.
bool writevAll(gio.types.OutputVector[] vectors, out size_t bytesWritten, gio.cancellable.Cancellable cancellable = null)Tries to write the bytes contained in the n_vectors vectors into the stream. Will block during the operation.
void writevAllAsync(gio.types.OutputVector[] vectors, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Request an asynchronous write of the bytes contained in the nvectors vectors into the stream. When the operation is finished callback will be called. You can then call [gio.outputstream.OutputStrea...
bool writevAllFinish(gio.async_result.AsyncResult result, out size_t bytesWritten)Finishes an asynchronous stream write operation started with [gio.output_stream.OutputStream.writevAllAsync].
void writevAsync(gio.types.OutputVector[] vectors, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Request an asynchronous write of the bytes contained in nvectors vectors into the stream. When the operation is finished callback will be called. You can then call [gio.outputstream.OutputStream.wr...
bool writevFinish(gio.async_result.AsyncResult result, out size_t bytesWritten)Finishes a stream writev operation.
Constructors
this(void * ptr, Flag!"Take" take)

Fluent builder for [gio.output_stream.OutputStream]