package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gio/Ocgtk_gio/Gio/Wrappers/Input_stream/index.html
Module Wrappers.Input_stream
type t = [ `input_stream | `object_ ] Gobject.objval skip_finish : t -> [ `async_result ] Gobject.obj -> (int, GError.t) resultFinishes a stream skip operation.
val skip :
t ->
Gsize.t ->
[ `cancellable | `object_ ] Gobject.obj option ->
(int, GError.t) resultTries to skip @count bytes from the stream. Will block during the operation.
This is identical to g_input_stream_read(), from a behaviour standpoint, but the bytes that are skipped are not returned to the user. Some streams have an implementation that is more efficient than reading the data.
This function is optional for inherited classes, as the default implementation emulates it using read.
If @cancellable is not %NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an 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.
val read_finish : t -> [ `async_result ] Gobject.obj -> (int, GError.t) resultFinishes an asynchronous stream read operation.
val read_bytes_finish :
t ->
[ `async_result ] Gobject.obj ->
(Glib_bytes.t, GError.t) resultFinishes an asynchronous stream read-into-#GBytes operation.
val read_bytes :
t ->
Gsize.t ->
[ `cancellable | `object_ ] Gobject.obj option ->
(Glib_bytes.t, GError.t) resultLike g_input_stream_read(), this tries to read @count bytes from the stream in a blocking fashion. However, rather than reading into a user-supplied buffer, this will create a new #GBytes containing the data that was read. This may be easier to use from language bindings.
If count is zero, returns a zero-length #GBytes and does nothing. A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
On success, a new #GBytes is returned. It is not an error if the size of this object is not the same as the requested size, as it can happen e.g. near the end of a file. A zero-length #GBytes is returned on end of file (or if @count is zero), but never otherwise.
If @cancellable is not %NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error.
On error %NULL is returned and @error is set accordingly.
val read_all_finish :
t ->
[ `async_result ] Gobject.obj ->
(bool * Gsize.t, GError.t) resultFinishes an asynchronous stream read operation started with g_input_stream_read_all_async().
As a special exception to the normal conventions for functions that use #GError, if this function returns %FALSE (and sets @error) then @bytes_read will be set to the number of bytes that were successfully read before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around g_input_stream_read_async().
val is_closed : t -> boolChecks if an input stream is closed.
val has_pending : t -> boolChecks if an input stream has pending actions.
val close_finish :
t ->
[ `async_result ] Gobject.obj ->
(bool, GError.t) resultFinishes closing a stream asynchronously, started from g_input_stream_close_async().
val close :
t ->
[ `cancellable | `object_ ] Gobject.obj option ->
(bool, GError.t) resultCloses the stream, releasing resources related to it.
Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error.
Streams will be automatically closed when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.
Some streams might keep the backing store of the stream (e.g. a file descriptor) open after the stream is closed. See the documentation for the individual stream for details.
On failure the first error that happened will be reported, but the close operation will finish as much as possible. A stream that failed to close will still return %G_IO_ERROR_CLOSED for all operations. Still, it is important to check and report the error to the user.
If @cancellable is not %NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. Cancelling a close will still leave the stream closed, but some streams can use a faster close that doesn't block to e.g. check errors.
val clear_pending : t -> unitClears the pending flag on @stream.