Gio.PollableInputStream::read_nonblocking
function vfunc_read_nonblocking(buffer: void, count: Number(gsize)): Number(gssize) { }
Attempts to read up to count bytes from stream into buffer, as with Gio.InputStream.prototype.read. If stream is not currently readable, this will immediately return Gio.IOErrorEnum.would_block, and you can use Gio.PollableInputStream.prototype.create_source to create a GLib.Source that will be triggered when stream is readable.
Note that since this method never blocks, you cannot actually use @cancellable to cancel it. However, it will return an error if @cancellable has already been cancelled when you call, which may happen if you call this method after a source triggers due to having been cancelled.
- buffer
a buffer to read data into (which should be at least count bytes long).
- count
the number of bytes you want to read
- Returns
the number of bytes read, or -1 on error (including Gio.IOErrorEnum.would_block).