pollableStreamWrite
fn
ptrdiff_t pollableStreamWrite(gio.output_stream.OutputStream stream, ubyte[] buffer, bool blocking, gio.cancellable.Cancellable cancellable = null)Tries to write to stream, as with [gio.output_stream.OutputStream.write] (if blocking is true) or [gio.pollable_output_stream.PollableOutputStream.writeNonblocking] (if blocking is false). This can be used to more easily share code between blocking and non-blocking implementations of a method.
If blocking is false, then stream must be a #GPollableOutputStream for which [gio.pollable_output_stream.PollableOutputStream.canPoll] returns true or else the behavior is undefined. If blocking is true, then stream does not need to be a #GPollableOutputStream.
Parameters
stream | a #GOutputStream. |
buffer | the buffer containing the data to write. |
blocking | whether to do blocking I/O |
cancellable | optional #GCancellable object, null to ignore. |
Returns
the number of bytes written, or -1 on error.
Throws
[ErrorWrap]