pollableStreamWrite

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 gio.output_stream.OutputStream

a #GOutputStream.

buffer ubyte[]

the buffer containing the data to write.

blocking bool

whether to do blocking I/O

cancellable gio.cancellable.Cancellable

optional #GCancellable object, null to ignore.

Return Value

Type: ptrdiff_t

the number of bytes written, or -1 on error.