BatBuffer

# Module BatBuffer

    module BatBuffer: sig .. end

Extensible string buffers.

This module implements string buffers that automatically expand as necessary. It provides accumulative concatenation of strings in quasi-linear time (instead of quadratic time when strings are concatenated pairwise).

This module extends Stdlib's Buffer module, go there for documentation on the rest of the functions and types.
Author(s): Pierre Weis (Base module), Xavier Leroy (Base module), David Teller, Dawid Toton

    val enum : Buffer.t -> char BatEnum.t

Returns an enumeration of the characters of a buffer.

Contents of the enumeration is unspecified if the buffer is modified after the enumeration is returned.

    val of_enum : char BatEnum.t -> Buffer.t

Creates a buffer from a character enumeration.

    val blit : Buffer.t -> int -> string -> int -> int -> unit

`Buffer.blit b srcoff dst dstoff len` copies `len` characters from the current contents of the buffer `b` starting at offset `off`, starting at character number `srcoff`, to string `dst`, starting at character number `dstoff`.
Raises `Invalid_argument` if `srcoff` and `len` do not designate a valid substring of the buffer, or if `dstoff` and `len` do not designate a valid substring of `dst`.

    val add_input : Buffer.t -> BatInnerIO.input -> int -> unit

`add_input b ic n` reads exactly `n` character from the input `ic` and stores them at the end of buffer `b`. Raise `End_of_file` if the channel contains fewer than `n` characters.

    val add_channel : Buffer.t -> BatInnerIO.input -> int -> unit

    val output_buffer : 'a BatInnerIO.output -> Buffer.t -> unit

`output_buffer oc b` writes the current contents of buffer `b` on the output channel `oc`.

###### Boilerplate code

Printing

    val print : 'a BatInnerIO.output -> Buffer.t -> unit