pollable_stream_read


Description:

public ssize_t pollable_stream_read (InputStream stream, uint8[] buffer, bool blocking, Cancellable? cancellable = null) throws Error

Tries to read from stream, as with read (if blocking is true) or read_nonblocking (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 PollableInputStream for which can_poll returns true , or else the behavior is undefined. If blocking is true, then stream does not need to be a PollableInputStream.

Parameters:

stream

a InputStream

buffer

a buffer to read data into

blocking

whether to do blocking I/O

cancellable

optional Cancellable object, null to ignore.

count

the number of bytes to read

Returns:

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


Namespace: GLib
Package: gio-2.0