package avro

  1. Overview
  2. Docs

Module Avro.InputSource

Input

A source of bytes.

Sourcetype t
Sourceval of_string : string -> t
Sourceval of_string_compressed_deflate : string -> t

Read from a string that is compressed using zlib. This will handle the decompression.

Sourceval of_chan : in_channel -> t

Input that reads from the given channel.

Sourceval with_file : ?flags:open_flag list -> string -> (t -> 'a) -> 'a

Opens file, call the function with an input feeding from the file, and makes sure to cleanup before returning the function's result.

Sourcemodule type CUSTOM = sig ... end

Custom inputs

Sourceval of_custom : (module CUSTOM) -> t

User defined input

Sourceval read_byte : t -> char

read_byte i returns the next char, or raises

Sourceval read_exact : t -> bytes -> int -> int -> unit

read_exact i buf off len reads len bytes from i

  • raises End_of_file

    if less than len bytes are in the input.

Sourceval read_uint64 : t -> int64
Sourceval read_int64 : t -> int64
Sourceval read_int : t -> int
Sourceval read_bool : t -> bool
Sourceval read_string_of_len : t -> int -> string
Sourceval read_float32 : t -> float
Sourceval read_float64 : t -> float
Sourceval read_string : t -> string

Read length-prefixed string

Sourceval read_array : (t -> 'a) -> t -> 'a array
Sourceval read_map : (t -> 'a) -> t -> 'a Map.Make(String).t
OCaml

Innovation. Community. Security.