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/Data_input_stream/index.html

Module Wrappers.Data_input_stream

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

Create a new DataInputStream

val set_newline_type : t -> Gio_enums.datastreamnewlinetype -> unit

Sets the newline type for the @stream.

Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read chunk ends in "CR" we must read an additional byte to know if this is "CR" or "CR LF", and this might block if there is no more data available.

val set_byte_order : t -> Gio_enums.datastreambyteorder -> unit

This function sets the byte order for the given @stream. All subsequent reads from the @stream will be read in the given @order.

val read_upto_finish : t -> [ `async_result ] Gobject.obj -> (string * Gsize.t, GError.t) result

Finish an asynchronous call started by g_data_input_stream_read_upto_async().

Note that this function does not consume the stop character. You have to use g_data_input_stream_read_byte() to get it before calling g_data_input_stream_read_upto_async() again.

The returned string will always be nul-terminated on success.

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

Reads a string from the data input stream, up to the first occurrence of any of the stop characters.

In contrast to g_data_input_stream_read_until(), this function does not consume the stop character. You have to use g_data_input_stream_read_byte() to get it before calling g_data_input_stream_read_upto() again.

Note that @stop_chars may contain '\0' if @stop_chars_len is specified.

The returned string will always be nul-terminated on success.

val read_until_finish : t -> [ `async_result ] Gobject.obj -> (string * Gsize.t, GError.t) result

Finish an asynchronous call started by g_data_input_stream_read_until_async().

val read_until : t -> string -> [ `cancellable | `object_ ] Gobject.obj option -> (string * Gsize.t, GError.t) result

Reads a string from the data input stream, up to the first occurrence of any of the stop characters.

Note that, in contrast to g_data_input_stream_read_until_async(), this function consumes the stop character that it finds.

Don't use this function in new code. Its functionality is inconsistent with g_data_input_stream_read_until_async(). Both functions will be marked as deprecated in a future release. Use g_data_input_stream_read_upto() instead, but note that that function does not consume the stop character.

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

Reads an unsigned 64-bit/8-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order().

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.

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

Reads an unsigned 32-bit/4-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

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.

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

Reads an unsigned 16-bit/2-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

val read_line_utf8 : t -> [ `cancellable | `object_ ] Gobject.obj option -> (string option * Gsize.t, GError.t) result

Reads a UTF-8 encoded line from the data input stream.

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.

val read_line_finish_utf8 : t -> [ `async_result ] Gobject.obj -> (string option * Gsize.t, GError.t) result

Finish an asynchronous call started by g_data_input_stream_read_line_async().

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

Reads a 64-bit/8-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

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.

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

Reads a signed 32-bit/4-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

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.

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

Reads a 16-bit/2-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

val get_newline_type : t -> Gio_enums.datastreamnewlinetype

Gets the current newline type for the @stream.

val get_byte_order : t -> Gio_enums.datastreambyteorder

Gets the byte order for the data input stream.