package biniou
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=8bf3ff17cd0ecb2d6b6d1d94cb08ef089d44caef96e9bae6be6839d428fa318f
sha512=7d03b3759a3a2e1c77713aa1b8375a1f1917f49d14fe5e3cb01d5e53a12e6385b7a3b0f4827f3be71182c31c416d780e1f9ef011dc205cb8f9b0ab2d8fc23cfd
doc/biniou/Bi_stream/index.html
Module Bi_streamSource
Streaming utilities (experimental)
This module offers a streaming interface for representing long lists of elements that cannot fit in memory. Stream items are serialized as chunks of configurable length.
Stream format (independent from the biniou serialization format):
( ONE INT64 BYTE* )* ZERO
where INT64 is the length of a chunk (unsigned big-endian 64-bit int), i.e. the number of following BYTEs. ONE and ZERO are the single-byte representations of 1 and 0 and are used to indicate whether the end of the stream is reached.
read_stream of_string ic creates an OCaml stream from an input channel ic. The data come in chunks and each chunk is converted from a string to an array by calling of_string.
val write_stream :
?chunk_len:int ->
('a array -> string) ->
out_channel ->
'a Stream.t ->
unitwrite_stream to_string oc st writes an OCaml stream to the output channel oc. It creates chunks of chunk_len, except for the last chunk which is usually smaller.