SimpleIO.IO_Bytes

Byte sequence operations

Note: descriptions of the interface are derived from OCaml's documentation: https://caml.inria.fr/pub/docs/manual-ocaml/libref/Bytes.html


Module OBytes.

Return the length (number of bytes) of the argument.
Parameter length : bytes -> int.

get s n returns the byte at index n in s.
Parameter get : bytes -> int -> IO char.

set s n c modifies s, replacing the byte at index n with c.
Parameter set : bytes -> int -> char -> IO unit.

sub s start len returns a new byte sequence of length len, containing the subsequence of s that starts at position start and has length len.
Parameter sub : bytes -> int -> int -> IO bytes.

create n returns a new byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.
Raise Invalid_argument if n < 0 or n > system's maximum length of byte sequences.
Parameter create : int -> IO bytes.

Return a new byte sequence that contains the same bytes as the given string.
Return a new string that contains the same bytes as the given byte sequence.
Parameter to_string : bytes -> IO ocaml_string.


End OBytes.