package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gio/Ocgtk_gio/Gio/Wrappers/Buffered_input_stream/index.html

Module Wrappers.Buffered_input_stream

type t = [ `buffered_input_stream | `filter_input_stream | `input_stream | `object_ ] Gobject.obj
val new_ : [ `input_stream | `object_ ] Gobject.obj -> t

Create a new BufferedInputStream

val new_sized : [ `input_stream | `object_ ] Gobject.obj -> Gsize.t -> t

Create a new BufferedInputStream

val set_buffer_size : t -> Gsize.t -> unit

Sets the size of the internal buffer of @stream to @size, or to the size of the contents of the buffer. The buffer can never be resized smaller than its current contents.

val read_byte : t -> [ `cancellable | `object_ ] Gobject.obj option -> (int, GError.t) result

Tries to read a single byte from the stream or the buffer. Will block during this read.

On success, the byte read from the stream is returned. On end of stream -1 is returned but it's not an exceptional error and @error is not set.

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 -1 is returned and @error is set accordingly.

val get_buffer_size : t -> Gsize.t

Gets the size of the input buffer.

val get_available : t -> Gsize.t

Gets the size of the available data within the stream.

val fill_finish : t -> [ `async_result ] Gobject.obj -> (int, GError.t) result

Finishes an asynchronous read.

val fill : t -> int -> [ `cancellable | `object_ ] Gobject.obj option -> (int, GError.t) result

Tries to read @count bytes from the stream into the buffer. Will block during this read.

If @count is zero, returns zero and does nothing. A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.

On success, the number of bytes read into the buffer is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. near the end of a file. Zero is returned on end of file (or if @count is zero), but never otherwise.

If @count is -1 then the attempted read size is equal to the number of bytes that are required to fill the buffer.

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 -1 is returned and @error is set accordingly.

For the asynchronous, non-blocking, version of this function, see g_buffered_input_stream_fill_async().