InputStream
Object Hierarchy:
Description:
GInputStream has functions to read from a stream (g_input_stream_read()), to close a stream (g_input_stream_close()) and to skip some
content (g_input_stream_skip()).
To copy the content of an input stream to an output stream without manually handling the reads and writes, use
splice.
All of these functions have async variants too.
Namespace: GLib
Package: gio-2.0
Content:
Creation methods:
Methods:
-
public void clear_pending ()
Clears the pending flag on stream.
-
public bool close (Cancellable? cancellable = null) throws IOError
Closes the stream, releasing resources related to it.
-
public virtual async bool close_async (int io_priority = DEFAULT, Cancellable? cancellable = null) throws IOError
Requests an asynchronous closes of the stream, releasing resources related to it. When the operation
is finished callback will be called. You can then call g_input_stream_close_finish to get the result of
the operation.
-
public virtual bool close_fn (Cancellable? cancellable = null) throws Error
-
public bool has_pending ()
Checks if an input stream has pending actions.
-
public bool is_closed ()
Checks if an input stream is closed.
-
public virtual ssize_t read (uint8[] buffer, Cancellable? cancellable = null) throws IOError
Tries to read count bytes from the stream into the buffer starting at buffer
. Will block during this read.
-
public bool read_all (uint8[] buffer, out size_t bytes_read, Cancellable? cancellable = null) throws IOError
Tries to read count bytes from the stream into the buffer starting at buffer
. Will block during this read.
-
public virtual async ssize_t read_async (uint8[] buffer, int io_priority = DEFAULT, Cancellable? cancellable = null) throws IOError
Request an asynchronous read of count bytes from the stream into the buffer starting at
buffer. When the operation is finished callback will be called. You can then call
g_input_stream_read_finish to get the result of the operation.
-
public bool set_pending () throws Error
Sets stream to have actions pending. If the pending flag is already set or stream
is closed, it will return false and set error.
-
public virtual ssize_t skip (size_t count, Cancellable? cancellable = null) throws IOError
Tries to skip count bytes from the stream. Will block during the operation.
-
public virtual async ssize_t skip_async (size_t count, int io_priority = DEFAULT, Cancellable? cancellable = null) throws IOError
Request an asynchronous skip of count bytes from the stream. When the operation is
finished callback will be called. You can then call g_input_stream_skip_finish to get the result of the
operation.