package avro-simple

  1. Overview
  2. Docs

Module Avro_simple.OutputSource

Binary output encoding for Avro

Sourcetype t

The output encoder type that wraps a buffer for writing binary data

Sourceval create : unit -> t

create () creates a new output encoder with a fresh buffer

Sourceval of_buffer : Buffer.t -> t

of_buffer buffer creates an output encoder from an existing buffer

Sourceval contents : t -> string

contents t returns the string contents of the encoder's buffer

Sourceval to_bytes : t -> bytes

to_bytes t returns the byte contents of the encoder's buffer

Sourceval zigzag32 : int -> int32

zigzag32 n encodes a signed integer using zigzag encoding. Zigzag encoding maps signed integers to unsigned integers so that numbers with small absolute values have small encoded values.

Sourceval zigzag64 : int64 -> int64

zigzag64 n encodes a signed 64-bit integer using zigzag encoding. Zigzag encoding maps signed integers to unsigned integers so that numbers with small absolute values have small encoded values.

Sourceval write_long : t -> int64 -> unit

write_long t n writes a 64-bit integer to the encoder using variable-length encoding with zigzag encoding for signed values

Sourceval write_int : t -> int -> unit

write_int t n writes an integer to the encoder using variable-length encoding with zigzag encoding for signed values

Sourceval write_null : t -> unit -> unit

write_null t () writes a null value (no-op in binary encoding)

Sourceval write_boolean : t -> bool -> unit

write_boolean t b writes a boolean value as a single byte

Sourceval write_float : t -> float -> unit

write_float t f writes a 32-bit floating point value in little-endian byte order

Sourceval write_double : t -> float -> unit

write_double t f writes a 64-bit floating point value in little-endian byte order

Sourceval write_bytes : t -> bytes -> unit

write_bytes t bytes writes a byte sequence with length prefix

Sourceval write_string : t -> string -> unit

write_string t str writes a string with length prefix

Sourceval write_fixed : t -> bytes -> unit

write_fixed t bytes writes fixed-length bytes without a length prefix