package prr

  1. Overview
  2. Docs

DataView objects (byte-level typed data access on ArrayBuffers).

This module allows to read and write buffers with any data element at any byte offset.

type t

The type for DataView objects.

val of_buffer : ?byte_offset:int -> ?byte_length:int -> Buffer.t -> t

of_buffer ~byte_offset ~length b k provides access to byte_length (defaults to Buffer.byte_length b) bytes of b starting at byte offset byte_offset.

val buffer : t -> Buffer.t

buffer d is the untyped buffer of d.

val byte_offset : t -> int

byte_offset d is the byte index where d starts in buffer d.

val byte_length : t -> int

byte_length d is the byte length of d.

Reads

Suffixes. _be stands for big endian, _le for little endian.

val get_int8 : t -> int -> int
val get_int16_be : t -> int -> int
val get_int16_le : t -> int -> int
val get_int32_be : t -> int -> int32
val get_int32_le : t -> int -> int32
val get_uint8 : t -> int -> int
val get_uint16_be : t -> int -> int
val get_uint16_le : t -> int -> int
val get_uint32_be : t -> int -> int32
val get_uint32_le : t -> int -> int32
val get_float32_be : t -> int -> float
val get_float32_le : t -> int -> float
val get_float64_be : t -> int -> float
val get_float64_le : t -> int -> float

Writes

Suffixes. _be stands for big endian, _le for little endian.

val set_int8 : t -> int -> int -> unit
val set_int16_be : t -> int -> int -> unit
val set_int16_le : t -> int -> int -> unit
val set_int32_be : t -> int -> int32 -> unit
val set_int32_le : t -> int -> int32 -> unit
val set_uint8 : t -> int -> int -> unit
val set_uint16_be : t -> int -> int -> unit
val set_uint16_le : t -> int -> int -> unit
val set_uint32_be : t -> int -> int32 -> unit
val set_uint32_le : t -> int -> int32 -> unit
val set_float32_be : t -> int -> float -> unit
val set_float32_le : t -> int -> float -> unit
val set_float64_be : t -> int -> float -> unit
val set_float64_le : t -> int -> float -> unit
OCaml

Innovation. Community. Security.