package decompress
Library
Module
Module type
Parameter
Class
Class type
Deflate algorithm.
A functionnal non-blocking implementation of Zlib algorithm.
Deflate error.
module F : sig ... end
Frequencies module.
val pp_error : Format.formatter -> error -> unit
Pretty-printer of deflate error.
val pp : Format.formatter -> ('i, 'o) t -> unit
Pretty-printer of deflate state.
get_frequencies t
returns the current frequencies of the deflate state. See F.t
.
set_frequencies f t
replaces the frequencies of the state t
by f
. The paranoid mode (if paranoid = true
) checks if the frequencies can be used with the internal Hunk.t list
. That means, for all characters and patterns (see Hunk.t
), the binding frequencie must be > 0
(however, this check takes a long time).
eg. if we have a Literal 'a'
, (fst f).(Char.code 'a') > 0
.
finish t
means all input was sended. t
will produce a new zlib block with the final
flag and write the checksum of the input stream.
no_flush off len t
means to continue the compression of an input at off
on len
byte(s).
partial_flush off len t
finishes the current block, then the encoder writes a fixed empty block. So, the output is not aligned. We keep the current frequencies to compute the new Huffman tree for the new next block.
sync_flush off len t
finishes the current block, then the encoder writes a stored empty block and the output is aligned. We keep the current frequencies to compute the new Huffman tree for the new next block.
full_flush off len t
finishes the current block, then the encoder writes a stored empty block and the output is aligned. We delete the current frequencies to compute a new frequencies from your input and write a new Huffman tree for the new next block.
flush_of_meth meth
returns the function depending to the method. Like, flush_of_meth SYNC
returns sync_flush
. It's a convenience function, nothing else.
flush off len t
allows the state t
to use an output at off
on len
byte(s).
val eval :
'a B.t ->
'a B.t ->
('a, 'a) t ->
[ `Await of ('a, 'a) t
| `Flush of ('a, 'a) t
| `End of ('a, 'a) t
| `Error of ('a, 'a) t * error ]
eval i o t
computes the state t
with the input i
and the ouput o
. This function returns:
val used_in : ('i, 'o) t -> int
used_in t
returns how many byte(s) was used by t
in the input.
val used_out : ('i, 'o) t -> int
used_out t
returns how many byte(s) was used by t
in the output.
default ~proof ?wbits level
makes a new state t
. ~proof
is an 'a
B.t
specialized with an implementation (see B.st
or B.bs
) to informs the state wich implementation you use.
?wbits
(by default, wbits = 15
) it's the size of the window used by the Lz77 algorithm (see L.default
).
?meth
can be specified to flush the internal buffer of the compression and create a new zlib block at n
bytes specified.
level
is level compression:
- 0: a stored compression (no compression)
- 1 .. 3: a fixed compression (compression with a static huffman tree)
- 4 .. 9: a dynamic compression (compression with a canonic huffman tree produced by the input)
val to_result :
'a B.t ->
'a B.t ->
?meth:(meth * int) ->
('a B.t -> int option -> int) ->
('a B.t -> int -> int) ->
('a, 'a) t ->
(('a, 'a) t, error) result
to_result i o refill flush t
is a convenience function to apply the deflate algorithm on the stream refill
and call flush
when the internal output is full (and need to flush).
If the compute catch an error, we returns Error exn
(see DEFLATE.error
). Otherwise, we returns the useless state t
.
val bytes :
Bytes.t ->
Bytes.t ->
?meth:(meth * int) ->
(Bytes.t -> int option -> int) ->
(Bytes.t -> int -> int) ->
(B.st, B.st) t ->
((B.st, B.st) t, error) result
Specialization of to_result
with B.Bytes.t
.
val bigstring :
B.Bigstring.t ->
B.Bigstring.t ->
?meth:(meth * int) ->
(B.Bigstring.t -> int option -> int) ->
(B.Bigstring.t -> int -> int) ->
(B.bs, B.bs) t ->
((B.bs, B.bs) t, error) result
Specialization of to_result
with B.Bigstring.t
.