package biniou
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=8bf3ff17cd0ecb2d6b6d1d94cb08ef089d44caef96e9bae6be6839d428fa318f
sha512=7d03b3759a3a2e1c77713aa1b8375a1f1917f49d14fe5e3cb01d5e53a12e6385b7a3b0f4827f3be71182c31c416d780e1f9ef011dc205cb8f9b0ab2d8fc23cfd
doc/biniou/Bi_outbuf/index.html
Module Bi_outbufSource
Output buffer
type t = {mutable o_s : bytes;(*Buffer string
*)mutable o_max_len : int;(*Same as
*)String.length smutable o_len : int;(*Length of the data present in the buffer = current position in the buffer
*)mutable o_offs : int;(*Length of data written and flushed out of the buffer. The total number of bytes written to the buffer is therefore
*)o_offs + o_len.o_init_len : int;(*Initial length of the buffer
*)o_make_room : t -> int -> unit;(*
*)make_room buf nmust provide space for at least the requested number of bytesn, typically by reallocating a larger buffer string or by flushing the data to a channel. This function is only called when there is not enough space fornbytes.
}Default make_room function: reallocate a larger buffer string.
Alternate make_room function: write to an out_channel.
Create a buffer. The default make_room function is really_extend.
Pair of convenience functions for creating a buffer that flushes data to an out_channel when it is full.
Pair of convenience functions for creating a buffer that flushes data to an object when it is full.
Guarantee that the buffer string has enough room for n additional bytes.
alloc buf n makes room for n bytes and returns the position of the first byte in the buffer string buf.s. It behaves as if n arbitrary bytes were added and it is the user's responsibility to set them to some meaningful values by accessing buf.s directly.
add_subbytes dst src srcpos len copies len bytes from bytes src to buffer dst starting from position srcpos.
add_substring dst src srcpos len copies len bytes from string src to buffer dst starting from position srcpos.
Add a byte to the buffer without checking that there is enough room for it.
Remove any data present in the buffer and in the table holding shared objects.