Module Bytesrw.Bytes

Extended Stdlib.Bytes module.

include module type of Stdlib.Bytes
val length : bytes -> int
val get : bytes -> int -> char
val set : bytes -> int -> char -> unit
val create : int -> bytes
val make : int -> char -> bytes
val init : int -> (int -> char) -> bytes
val empty : bytes
val copy : bytes -> bytes
val of_string : string -> bytes
val to_string : bytes -> string
val sub : bytes -> int -> int -> bytes
val sub_string : bytes -> int -> int -> string
val extend : bytes -> int -> int -> bytes
val fill : bytes -> int -> int -> char -> unit
val blit : bytes -> int -> bytes -> int -> int -> unit
val blit_string : string -> int -> bytes -> int -> int -> unit
val concat : bytes -> bytes list -> bytes
val cat : bytes -> bytes -> bytes
val iter : (char -> unit) -> bytes -> unit
val iteri : (int -> char -> unit) -> bytes -> unit
val map : (char -> char) -> bytes -> bytes
val mapi : (int -> char -> char) -> bytes -> bytes
val fold_left : ('acc -> char -> 'acc) -> 'acc -> bytes -> 'acc
val fold_right : (char -> 'acc -> 'acc) -> bytes -> 'acc -> 'acc
val for_all : (char -> bool) -> bytes -> bool
val exists : (char -> bool) -> bytes -> bool
val trim : bytes -> bytes
val escaped : bytes -> bytes
val index : bytes -> char -> int
val index_opt : bytes -> char -> int option
val rindex : bytes -> char -> int
val rindex_opt : bytes -> char -> int option
val index_from : bytes -> int -> char -> int
val index_from_opt : bytes -> int -> char -> int option
val rindex_from : bytes -> int -> char -> int
val rindex_from_opt : bytes -> int -> char -> int option
val contains : bytes -> char -> bool
val contains_from : bytes -> int -> char -> bool
val rcontains_from : bytes -> int -> char -> bool
val uppercase_ascii : bytes -> bytes
val lowercase_ascii : bytes -> bytes
val capitalize_ascii : bytes -> bytes
val uncapitalize_ascii : bytes -> bytes
type t = bytes
val compare : t -> t -> int
val equal : t -> t -> bool
val starts_with : prefix:bytes -> bytes -> bool
val ends_with : suffix:bytes -> bytes -> bool
val unsafe_to_string : bytes -> string
val unsafe_of_string : string -> bytes
val split_on_char : char -> bytes -> bytes list
val to_seq : t -> char Stdlib.Seq.t
val to_seqi : t -> (int * char) Stdlib.Seq.t
val of_seq : char Stdlib.Seq.t -> t
val get_utf_8_uchar : t -> int -> Stdlib.Uchar.utf_decode
val set_utf_8_uchar : t -> int -> Stdlib.Uchar.t -> int
val is_valid_utf_8 : t -> bool
val get_utf_16be_uchar : t -> int -> Stdlib.Uchar.utf_decode
val set_utf_16be_uchar : t -> int -> Stdlib.Uchar.t -> int
val is_valid_utf_16be : t -> bool
val get_utf_16le_uchar : t -> int -> Stdlib.Uchar.utf_decode
val set_utf_16le_uchar : t -> int -> Stdlib.Uchar.t -> int
val is_valid_utf_16le : t -> bool
val get_uint8 : bytes -> int -> int
val get_int8 : bytes -> int -> int
val get_uint16_ne : bytes -> int -> int
val get_uint16_be : bytes -> int -> int
val get_uint16_le : bytes -> int -> int
val get_int16_ne : bytes -> int -> int
val get_int16_be : bytes -> int -> int
val get_int16_le : bytes -> int -> int
val get_int32_ne : bytes -> int -> int32
val get_int32_be : bytes -> int -> int32
val get_int32_le : bytes -> int -> int32
val get_int64_ne : bytes -> int -> int64
val get_int64_be : bytes -> int -> int64
val get_int64_le : bytes -> int -> int64
val set_uint8 : bytes -> int -> int -> unit
val set_int8 : bytes -> int -> int -> unit
val set_uint16_ne : bytes -> int -> int -> unit
val set_uint16_be : bytes -> int -> int -> unit
val set_uint16_le : bytes -> int -> int -> unit
val set_int16_ne : bytes -> int -> int -> unit
val set_int16_be : bytes -> int -> int -> unit
val set_int16_le : bytes -> int -> int -> unit
val set_int32_ne : bytes -> int -> int32 -> unit
val set_int32_be : bytes -> int -> int32 -> unit
val set_int32_le : bytes -> int -> int32 -> unit
val set_int64_ne : bytes -> int -> int64 -> unit
val set_int64_be : bytes -> int -> int64 -> unit
val set_int64_le : bytes -> int -> int64 -> unit
val unsafe_get : bytes -> int -> char
val unsafe_set : bytes -> int -> char -> unit
val unsafe_blit : bytes -> int -> bytes -> int -> int -> unit
val unsafe_blit_string : string -> int -> bytes -> int -> int -> unit
val unsafe_fill : bytes -> int -> int -> char -> unit
val unsafe_escape : bytes -> bytes

Byte streams

module Slice : sig ... end

Byte slices.

module Stream : sig ... end

Byte streams.

module Reader : sig ... end

Byte stream readers.

module Writer : sig ... end

Byte stream writers.

Formatters

val pp_hex : ?addr:bool -> ?addr_start:int -> ?addr_div:int -> ?count:int -> ?group:int -> ?ascii:bool -> ?start:int -> ?len:int -> unit -> Stdlib.Format.formatter -> bytes -> unit

pp_hex ~addr ~addr_start ~count ~group ~ascii ~start ~len:n () ppf b prints the bytes in range [start;start + n - 1] in hexadecimal. start defaults to 0 and len to length b - start. Formats nothing if len is 0. The formatting options are as follows:

  • If addr is true (defaults to false), starts each line with the index of the first byte on the line as a 32-bit or 64-bit hexadecimal number (adjusted according the values of addr_start and len). Finishes the output with a blank line that has the address following the last byte.
  • If addr_start is specified uses this as the start index for the first byte (defaults to start)
  • If addr_div is specified addresses are divided by this number. Defaults to 1. For example using 4 indexes by 32-bits.
  • count defines the number of bytes, printed on each line. Defaults to 16.
  • group is the number of bytes that are grouped together. Defaults to 2, i.e. shows hexadecimal 16-bit numbers.
  • If ascii is true (defaults to false) ends each line with a column with the bytes interpreted as US-ASCII.