Virtual Method
GioPollableInputStreamread_nonblocking
Declaration [src]
gssize
read_nonblocking (
GPollableInputStream* stream,
void* buffer,
gsize count,
GError** error
)
Description [src]
Attempts to read up to count bytes from stream into buffer, as
with g_input_stream_read(). If stream is not currently readable,
this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can
use g_pollable_input_stream_create_source() to create a GSource
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.
The behaviour of this method is undefined if
g_pollable_input_stream_can_poll() returns FALSE for stream.
Parameters
buffer-
Type: An array of
guint8A buffer to read data into (which should be at least
countbytes long).The argument will be set by the function. The argument can be set to NULLby the virtual function.The length of the array is specified in the countargument.The returned data is owned by the instance. count-
Type:
gsizeThe number of bytes you want to read.
error-
Type:
GError **The return location for a recoverable error.
The argument can be NULL.If the return location is not NULL, then you must initialize it to aNULLGError*.The argument will be left initialized to NULLby the virtual function if there are no errors.In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.