val alloc : int -> t
alloc size allocates an io buffer of
size and set its read pointer and write pointer to 0.
val getc : t -> char option
getc b reads the character at the read pointer of the buffer
b, advances the read pointer and returns the character. If the read pointer is at the position of the write pointer, then
None is retured.
val putc : t -> char -> unit option
putc b ch appends the character
c at the position of the write pointer and advances the write pointer. If the write pointer is already at the end
None is returned.
val capacity : t -> int
The capacity of the buffer.
val length : t -> int
The length of the content of the buffer.
val read_pointer : t -> int
Position of the next character to read.
val write_pointer : t -> int
Position of the next character to write.
val is_empty : t -> bool
Is the buffer empty?
read_pointer = write_pointer
val is_full : t -> bool
Is the buffer full?
val reset : t -> unit
Set the read and the write pointer to zero.
val set_read_pointer : t -> int -> unit
Set the read pointer.
val set_write_pointer : t -> int -> unit
Set the write pointer.
copy src s0 s1 dst d0 copies the data from the buffer
src between position
s1 to the buffer
dst starting at position
d0. Overlapping is handled properly.