Gio.pollable_stream_write_all
function pollable_stream_write_all(stream: Gio.OutputStream, buffer: ByteArray, blocking: Boolean, cancellable: Gio.Cancellable): [ok: Boolean, bytes_written: Number(gsize)] { // Gjs wrapper for g_pollable_stream_write_all() }
Tries to write count bytes to stream, as with Gio.OutputStream.prototype.write_all, but using Gio.pollable_stream_write rather than Gio.OutputStream.prototype.write.
On a successful write of count bytes, true is returned, and bytes_written is set to count.
If there is an error during the operation (including Gio.IOErrorEnum.would_block in the non-blocking case), false is returned and @error is set to indicate the error status, bytes_written is updated to contain the number of bytes written into the stream before the error occurred.
As with Gio.pollable_stream_write, if blocking is false, then stream must be a Gio.PollableOutputStream for which Gio.PollableOutputStream.prototype.can_poll returns true or else the behavior is undefined. If blocking is true, then stream does not need to be a Gio.PollableOutputStream.
Since 2.34
- stream
- buffer
the buffer containing the data to write.
- blocking
whether to do blocking I/O
- cancellable
optional Gio.Cancellable object, null to ignore.
- ok
true on success, false if there was an error
- bytes_written
location to store the number of bytes that was written to the stream