package decompress

  1. Overview
  2. Docs
Implementation of Zlib and GZip in OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

decompress-1.4.3.tbz
sha256=b22254ae5eb7747452267fc976a3a0ba408c5afdae0896cac4068b4d79ed5a3d
sha512=96f62147f4e0548bb7c4680c4f9d7492a2b4a9e15bc100447b16842e3d1b43ed902fdef03907e1416c174a0586428e515f2deef53ed04098a0443a535938dd6d

doc/decompress.de/De/Lz77/index.html

Module De.Lz77Source

Sourcetype src = [
  1. | `Channel of in_channel
  2. | `String of string
  3. | `Manual
]

The type for input sources. With a `Manual source the client must provide input with src. With `String or `Channel source the client can safely discard `Await case (with assert false).

Sourcetype decode = [
  1. | `Flush
  2. | `Await
  3. | `End
]
Sourcetype state

The type for states.

Sourceval literals : state -> literals

literals s is frequencies of lengths and literals emitted by s since it was created.

Sourceval distances : state -> distances

distances s is frequencies of distances emitted by s since it was created.

Sourceval checksum : state -> optint

checksum s is ADLER-32 checksum of consumed inputs.

Sourceval src : state -> bigstring -> int -> int -> unit

src s i j l provides s with l bytes to read, starting at j in i. This byte range is read by calls to compress with s until `Await is returned. To signal the end of input call the function with l = 0.

Sourceval src_rem : state -> int

src_rem s is how many bytes it remains in given input buffer.

Sourceval compress : state -> decode

compress s is:

  • `Await if s has a `Manual input source and awits for more input. The client must use src to provide it.
  • `Flush if s filled completely the shared-queue q (given in state). Queue.junk_exn or Queue.pop_exn can be used to give some free cells to compress.
  • `End if s compressed all input. Given shared-queue q is possibly not empty.
Sourcetype window
Sourceval make_window : bits:int -> window
Sourceval state : ?level:int -> q:Queue.t -> w:window -> src -> state

state src ~w ~q is an state that inputs from src and that outputs to q.

Window.

The client can constrain lookup operation by a window. Small window enforces compress to emit small distances. However, large window allows compress to go furthermore to recognize a pattern which can be expensive.

OCaml

Innovation. Community. Security.