type src = [
`Channel of in_channel
`String of string
The type for input sources. With a
`Manual source the client must provide input with
`Channel source the client can safely discard
`Await case (with
decoder src ~o ~allocate is a decoder that inputs from
ZLIB has a header to specify the window size needed to inflate a given input. When
zl knows that, it calls
allocate with a number
bits so that
1 lsl bits is the size of the window.
bits can not be larger than 15 nor lower than 8.
allocate can be
fun bits -> De.make_window ~bits or a previously allocated window.
decoder will take the ownership on it!
Ownership in our case means that
decode will mutate it in-place and expect it to remain unchanged between invocations.
decode d0 is:
`Manualinput source and awaits for more input. The client must use a
d1to provide it.
`Flush d1if given output buffer
decoder) needs to be drained before work can be resumed. The client must use
d1to completely flush
owill be full and consist fully of bytes that need to be copied from the buffer, but sometimes only the first part of the buffer is used. In those cases
dst_remwill give you the amount of free/unused bytes remain in
o. These should not be copied since their contents are not part of the output. Instead, the first
bigstring_length o - Inf.dst_rem d1bytes should be copied when flushing
`Malformed errif given input is malformed.
erris a human-readable error message.
`End d1if given input notify end of flow.
ois possibly not empty (it can be check with
reset d is a
d in its original state, as it was initialized by
src d s j l provides
l bytes to read, starting at
s. This byte range is read by calls to
`Await is returned. To signal the end of input call the function with
l = 0.
val dst_rem : decoder -> int
dst_rem d is how many unused bytes remain in the output buffer of
val src_rem : decoder -> int
src_rem d is how many unprocessed bytes remain in the input buffer of
val write : decoder -> int
write d is how many bytes
d emitted since it was created.
flush d is a decoder where internal output buffer
o is completely free to store bytes.
module Ns : sig ... end
A non-streamable implementation of the RFC 1950. It considers the input to be whole and is therefore able to save some time