Library
Module
Module type
Parameter
Class
Class type
RFC1951/DEFLATE is a IETF standard. Module provides non-blocking streaming codec to decode and encode DEFLATE encoding. It can efficiently work payload by payload without blocking IO.
Module provides LZ77 compression algorithm but let the client to define his algorithm as long as he uses shared queue provided in this module.
de
wants to be self-contained. By this constraint, it provides convenience values to be used by others (like zz
). The client should not use these functions even if they are available. Others libraries like Bigstringaf
serve the same purpose of a much better way.
module Bigarray = Bigarray_compat
MirageOS compatibility.
type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
The type for bigstring
.
type optint = Optint.t
Type type for optimal integer.
val bigstring_create : int -> bigstring
bigstring_create len
returns a uninitialized bigstring of length len
.
val bigstring_length : bigstring -> int
bigstring_length t
is the length of the bigstring t
, in bytes.
val make_window : bits:int -> window
make_window
allocates a new buffer which represents a window. It used by decoder and LZ77 compressor to keep tracking older inputs and:
val window_bits : window -> int
Decoder of RFC1951 DEFLATE codec. de
provides a Inf.decoder
to decode DEFLATE input and inflate it.
module Inf : sig ... end
DEFLATE encoder needs a compressed input which can be transmited by a shared queue filled by compression algorithm. B
is used between N
and a compression algorithm like L
. It provides a small representation of commands (see Queue.cmd
) emitted by compression algorithm.
N
encoder interprets Queue.cmd
as fast as it can. Shared queue can be a bottleneck about the whole compression process. Indeed, it limits encoder on how many bytes it can produce. We recommend to make a queue as large as output buffer.
module Queue : sig ... end
DYNAMIC DEFLATE block needs frequencies of code emitted by compression algorithm. literals
and distances
exist to keep frequencies while compression process.
val make_literals : unit -> literals
make_literals
allocates a new literals
where frequencies of symbols (expect End Of Block) are set to 0.
val make_distances : unit -> distances
make_distances
allocates a new distances
where frequencies of distance symboles are set to 0.
val succ_literal : literals -> char -> unit
succ_literals literals chr
increases frequency of chr
.
val succ_length : literals -> int -> unit
succ_length literals l
increases frequency of l
code. l
must be upper than 2 and lower than 259 according DEFLATE codec. Otherwise, it raises an Invalid_argument
.
val succ_distance : distances -> int -> unit
succ_distance distance d
increases frequency of d
code. d
must be upper than 0 and lower than 32769 according DEFLATE codec. Otherwise, it raises an Invalid_argument
.
module Def : sig ... end
Distribution provides LZ77 compression algorithm which can be used with N
. However, the client must know others algorithms exist. This algorithm is used by zz
to implement ZLIB layer.
module Lz77 : sig ... end
de
provides useful but complex API. This sub-module provides an easier way to compress/uncompress DEFLATE codec. Even if the client still can give some details, we recommend to use M
and N
if you want a precise control about memory consumption.
module Higher : sig ... end
/ *
val unsafe_set_cursor : Inf.decoder -> int -> unit
module Lookup : sig ... end
module T : sig ... end