Module Bigstring


module Bigstring: sig .. end
Types and exceptions



Types and exceptions

type t = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t 
Type of bigstrings
exception IOError of int * exn
Type of I/O errors

The occurred exception (e.g. Unix_error, End_of_file)


Creation and string conversion

val create : int -> t
create length
Returns a new bigstring having length.
val of_string : ?pos:int -> ?len:int -> string -> t
of_string ?pos ?len str
Returns a new bigstring that is equivalent to the substring of length len in str starting at position pos.
pos : default = 0
len : default = String.length str - pos
val to_string : ?pos:int -> ?len:int -> t -> string
val check_args : loc:string -> t -> pos:int -> len:int -> unit
val get_opt_len : t -> pos:int -> int option -> int

Accessors

val length : t -> int
length bstr
Returns the length of bigstring bstr.
val sub : ?pos:int -> ?len:int -> t -> t
sub ?pos ?len bstr
Returns the sub-bigstring in bstr that start at position pos and has length len.
pos : default = 0
len : default = Bigstring.length bstr - pos
val is_mmapped : t -> bool
is_mmapped bstr
Returns whether the bigstring bstr is memory-mapped.

Blitting

val blit : ?src_pos:int ->
src:t -> ?dst_pos:int -> dst:t -> int -> unit
val blit_string_bigstring : ?src_pos:int -> string -> ?dst_pos:int -> t -> len:int -> unit
val blit_bigstring_string : ?src_pos:int -> t -> ?dst_pos:int -> string -> len:int -> unit
val read : ?min_len:int -> Unix.file_descr -> ?pos:int -> ?len:int -> t -> int
val really_read : Unix.file_descr -> ?pos:int -> ?len:int -> t -> unit
val really_recv : Unix.file_descr -> ?pos:int -> ?len:int -> t -> unit
val read_assume_nonblocking : Unix.file_descr -> ?pos:int -> ?len:int -> t -> int
val input : ?min_len:int ->
Pervasives.in_channel -> ?pos:int -> ?len:int -> t -> int
val really_input : Pervasives.in_channel -> ?pos:int -> ?len:int -> t -> unit
val really_write : Unix.file_descr -> ?pos:int -> ?len:int -> t -> unit
val really_send_no_sigpipe : Unix.file_descr -> ?pos:int -> ?len:int -> t -> unit
val send_nonblocking_no_sigpipe : Unix.file_descr -> ?pos:int -> ?len:int -> t -> int option
val write : Unix.file_descr -> ?pos:int -> ?len:int -> t -> int
val write_assume_nonblocking : Unix.file_descr -> ?pos:int -> ?len:int -> t -> int
val writev : Unix.file_descr -> ?count:int -> t Unix_ext.IOVec.t array -> int
val writev_assume_nonblocking : Unix.file_descr -> ?count:int -> t Unix_ext.IOVec.t array -> int
val output : ?min_len:int ->
Pervasives.out_channel -> ?pos:int -> ?len:int -> t -> int
val really_output : Pervasives.out_channel -> ?pos:int -> ?len:int -> t -> unit
val map_file : shared:bool -> Unix.file_descr -> int -> t
map_file shared fd n memory-maps n characters of the data associated with descriptor fd to a bigstring. Iff shared is true, all changes to the bigstring will be reflected in the file.
val load_file : ?pos:int -> ?len:int -> string -> t
val store_file : ?create:bool ->
?exclusive:bool ->
?append:bool ->
?perm:int -> string -> ?pos:int -> ?len:int -> t -> unit
store_file ?create ?exclusive ?append ?perm fname ?pos ?len bstr store len bytes starting at position pos of bigstring bstr in file fname using the appropriate flags for opening (creation, exclusivity, appending, permissions).
create : default = true
exclusive : default = true
append : default = true
perm : default = 0o600
pos : default = 0
len : default = length bstr - pos

Unsafe functions

val unsafe_blit : src_pos:int ->
src:t -> dst_pos:int -> dst:t -> len:int -> unit
unsafe_blit ~src_pos ~src ~dst_pos ~dst ~len similar to Bigstring.blit, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_blit_string_bigstring : src_pos:int -> string -> dst_pos:int -> t -> len:int -> unit
unsafe_blit_string_bigstring_stub ~src_pos str ~dst_pos bstr ~len similar to Bigstring.blit_string_bigstring, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_blit_bigstring_string : src_pos:int -> t -> dst_pos:int -> string -> len:int -> unit
unsafe_blit_bigstring_string ~src_pos bstr ~dst_pos str ~len similar to Bigstring.blit_bigstring_string, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_read_assume_nonblocking : Unix.file_descr -> pos:int -> len:int -> t -> int
unsafe_read_assume_nonblocking fd ~pos ~len bstr similar to Bigstring.read_assume_nonblocking, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_write : Unix.file_descr -> pos:int -> len:int -> t -> int
unsafe_write fd ~pos ~len bstr similar to Bigstring.write, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_write_assume_nonblocking : Unix.file_descr -> pos:int -> len:int -> t -> int
unsafe_write_assume_nonblocking fd ~pos ~len bstr similar to Bigstring.write_assume_nonblocking, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_read : min_len:int -> Unix.file_descr -> pos:int -> len:int -> t -> int
unsafe_read ~min_len fd ~pos ~len bstr similar to Bigstring.read, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_really_recv : Unix.file_descr -> pos:int -> len:int -> t -> unit
unsafe_really_recv sock ~pos ~len bstr similar to Bigstring.really_recv, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_input : min_len:int ->
Pervasives.in_channel -> pos:int -> len:int -> t -> int
unsafe_input ~min_len ic ~pos ~len bstr similar to Bigstring.input, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_really_write : Unix.file_descr -> pos:int -> len:int -> t -> unit
unsafe_really_write fd ~pos ~len bstr similar to Bigstring.write, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_really_send_no_sigpipe : Unix.file_descr -> pos:int -> len:int -> t -> unit
unsafe_really_send_no_sigpipe sock ~pos ~len bstr similar to Bigstring.send, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_send_nonblocking_no_sigpipe : Unix.file_descr -> pos:int -> len:int -> t -> int option
unsafe_send_nonblocking_no_sigpipe sock ~pos ~len bstr similar to Bigstring.send_nonblocking_no_sigpipe, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_output : min_len:int ->
Pervasives.out_channel -> pos:int -> len:int -> t -> int
unsafe_output ~min_len oc ~pos ~len bstr similar to Bigstring.output, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_writev : Unix.file_descr -> t Unix_ext.IOVec.t array -> int -> int
unsafe_writev fd iovecs count similar to Bigstring.writev, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_sendmsg_nonblocking_no_sigpipe : Unix.file_descr -> t Unix_ext.IOVec.t array -> int -> int
unsafe_sendmsg_nonblocking_no_sigpipe fd iovecs count similar to Bigstring.sendmsg_nonblocking_no_sigpipe, but does not perform any bounds checks. Will crash on bounds errors!
val sendmsg_nonblocking_no_sigpipe : Unix.file_descr -> ?count:int -> t Unix_ext.IOVec.t array -> int