Iostream.In_buf
Buffered input stream.
class type t = object ... end
The implementation of buffered input streams.
class virtual t_from_refill : ?bytes:bytes -> unit -> object ... end
A mixin to implement a buffered input by only providing a refill
method. Add a close
method and it's good to go.
val create :
?bytes:bytes ->
?close:(unit -> unit) ->
refill:(bytes -> int) ->
unit ->
t
Create a new buffered input stream.
val of_bytes : ?off:int -> ?len:int -> bytes -> t
val of_string : ?off:int -> ?len:int -> string -> t
class bufferized : ?bytes:bytes -> In.t -> t
Read from the given buffer.
class of_in_channel : ?bytes:bytes -> in_channel -> t
val of_in_channel : ?bytes:bytes -> in_channel -> t
Wrap a standard input channel.
fill_buffer bic
returns a slice into bic
's internal buffer, and ensures it's empty only if bic.ic
is empty.
val input : t -> bytes -> int -> int -> int
Read into the given slice of bytes.
val consume : t -> int -> unit
consume bic n
consumes n
bytes from bic
. Precondition: n <= get_len bic
, ie. one cannot consume bytes that have not yet been obtained via fill_buffer
or fill_and_get
.
val close : t -> unit
Close the input stream.
val input_all_into_buffer : t -> Stdlib.Buffer.t -> unit
Read the whole content into the given buffer.
val input_all : ?buf:bytes -> t -> string
input_all ic
reads the whole content of ic
into a string.
val skip : t -> int -> unit
skip ic n
reads and dicards the next n
bytes in ic
.
val input_line : ?buffer:Stdlib.Buffer.t -> t -> string option
Read a line from the input. Return None
if the stream is empty.
val input_lines : ?buffer:Stdlib.Buffer.t -> t -> string list
Read all lines from the input.
val to_iter : t -> (char -> unit) -> unit
val to_seq : t -> char Stdlib.Seq.t
val of_seq : ?bytes:bytes -> char Stdlib.Seq.t -> t