module MrMime_base64:sig
..end
module Decoder:sig
..end
module Encoder:sig
..end
module Input:module type of RingBuffer.Committed
with type 'a t = 'a RingBuffer.Committed.t
type
Parser.err +=
| |
Wrong_padding |
"="
character.
Since all Base64 input is an integral number of octets, only the following cases can arise:
"="
padding."="
padding
characters."="
padding
character.Wrong_padding
.type 'a
decoder
typedecoding =
[ `Continue
| `Dirty of string
| `End of string
| `Error of Parser.err
| `String of string ]
val decoder : unit Parser.t * unit Parser.t ->
'a Input.t -> 'a decoder
decoder (boundary, rollback) input
is a Base64 decoder that inputs from
input
. boundary
specifies the limit of the decoding and rollback
allows the decoder to keep the boundary inside the input
.val decoder_src : 'a decoder -> 'a Input.t
decoder_src decoder
is decoder
's input source.val decode : 'a decoder -> decoding
decode decoder
is:`Continue
if decoder
awaits for more input. The client must use MrMime_base64.src
to provide it.`Dirty s
if decoder
has a padding error or if the character is not a
valid Base64 character (see is_b64
). If the client is interested in a
best-effort decoding it can still continue to decode after an dirty chunk.`Error exn
if decoder
has a padding error (Wrong_padding
error) - in
this case, the client doest not trust the content - or a parsing error.`String s
if a chunk s
was decoded.`End s
if the last chunk s
was decoded - when the decoder arises one
time this value, it returns only this value after the client recall
decode
.val src : 'a decoder -> string -> int -> int -> unit
src decoder buf off len
provides decoder
with len
bytes to read,
starting at off
in buf
. This byte range is read by calls to MrMime_base64.decode
until `Continue
is returned. To signal the end of input call the function
with len = 0
.