Ocamlnet 3 Reference Manual : Netnumber.BE

# Module Netnumber.BE

    module BE: ENCDEC

Encoders/decoders for big endian - network byte order

Encode/decode numbers as strings. These functions exist in two flavors:

- `Netnumber.BE` implements network byte order (big endian)
- `Netnumber.LE` implements little endian

    val read_int4 : string -> int -> Netnumber.int4

    val read_int8 : string -> int -> Netnumber.int8

    val read_uint4 : string -> int -> Netnumber.uint4

    val read_uint8 : string -> int -> Netnumber.uint8

`read_`<t> create integer values from the characters found at a certain position in the string. Raises `Out_of_range` if the position is bad

    val read_int4_unsafe : string -> int -> Netnumber.int4

    val read_int8_unsafe : string -> int -> Netnumber.int8

    val read_uint4_unsafe : string -> int -> Netnumber.uint4

    val read_uint8_unsafe : string -> int -> Netnumber.uint8

Same, but no index check

    val write_int4 : string -> int -> Netnumber.int4 -> unit

    val write_int8 : string -> int -> Netnumber.int8 -> unit

    val write_uint4 : string -> int -> Netnumber.uint4 -> unit

    val write_uint8 : string -> int -> Netnumber.uint8 -> unit

`write_`<t> copies the characters corresponding to the integer values into the string at the given positions. Raises `Out_of_range` if the position is bad.

    val write_int4_unsafe : string -> int -> Netnumber.int4 -> unit

    val write_int8_unsafe : string -> int -> Netnumber.int8 -> unit

    val write_uint4_unsafe : string -> int -> Netnumber.uint4 -> unit

    val write_uint8_unsafe : string -> int -> Netnumber.uint8 -> unit

`write_`<t>`_unsafe`: Same, but no index check.

    val int4_as_string : Netnumber.int4 -> string

    val int8_as_string : Netnumber.int8 -> string

    val uint4_as_string : Netnumber.uint4 -> string

    val uint8_as_string : Netnumber.uint8 -> string

<t>`_as_string`: Returns the corresponding string for an integer value

    val write_fp4 : string -> int -> Netnumber.fp4 -> unit

    val write_fp8 : string -> int -> Netnumber.fp8 -> unit

    val fp4_as_string : Netnumber.fp4 -> string

    val fp8_as_string : Netnumber.fp8 -> string

    val read_fp4 : string -> int -> Netnumber.fp4

    val read_fp8 : string -> int -> Netnumber.fp8