Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Iostream.In_buf
SourceBuffered input stream.
type t = private {
buf : bytes;
mutable len : int;
Length of the slice in buf
.
mutable off : int;
Offset in buf
.
fill_buffer : bytes -> int;
Refill buf
, return new length
. The newly read bytes must live in buf[0..len]
.
close : unit -> unit;
Close the stream. Idempotent.
*)}
Create a new buffered input stream.
Create an in stream from a raw Unix file descriptor. The file descriptor must be opened for reading.
Wrap a standard input channel.
val with_open_file :
?buf:bytes ->
?mode:int ->
?flags:Unix.open_flag list ->
string ->
(t -> 'a) ->
'a
fill_buffer bic
ensures that bic.buf
is empty only if bic.ic
is empty. Always call this before looking at bic.buf
.
Ensure the underlying buffer is not empty (unless end-of-input was reached), and return the active slice of it as a tuple bytes, offset, len
.
Postconditions: len = 0
if and only if the whole input stream has been consumed.
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
.
Read the whole content into the given buffer.
Read a line from the input. Return None
if the stream is empty.