IO.InputInput channel (byte source)
include module type of struct include Iostream.In_buf endclass type t = object ... endThe implementation of buffered input streams.
class virtual t_from_refill : ?bytes:bytes -> unit -> object ... endA 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 ->
tCreate a new buffered input stream.
val of_bytes : ?off:int -> ?len:int -> bytes -> tval of_string : ?off:int -> ?len:int -> string -> tclass bufferized : ?bytes:bytes -> Iostream.In.t -> tval bufferized : ?bytes:bytes -> Iostream.In.t -> tRead from the given buffer.
class of_in_channel : ?bytes:bytes -> in_channel -> tval of_in_channel : ?bytes:bytes -> in_channel -> tWrap a standard input channel.
val fill_buf : t -> Iostream.Slice.tfill_buffer bic returns a slice into bic's internal buffer, and ensures it's empty only if bic.ic is empty.
val of_in : ?bytes:bytes -> Iostream.In.t -> tMake a buffered version of the input stream.
val consume : t -> int -> unitconsume 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 into_in : t -> Iostream.In.tCast into a In.t. This doesn't allocate.
val input_all_into_buffer : t -> Stdlib.Buffer.t -> unitRead the whole content into the given buffer.
val input_all : ?buf:bytes -> t -> stringinput_all ic reads the whole content of ic into a string.
val copy_into : t -> Iostream.Out.t -> unitCopy the entire stream into the given output.
val skip : t -> int -> unitskip ic n reads and dicards the next n bytes in ic.
val input_line : ?buffer:Stdlib.Buffer.t -> t -> string optionRead a line from the input. Return None if the stream is empty.
val input_lines : ?buffer:Stdlib.Buffer.t -> t -> string listRead all lines from the input.
val to_iter : t -> (char -> unit) -> unitval to_seq : t -> char Stdlib.Seq.tval of_seq : ?bytes:bytes -> char Stdlib.Seq.t -> tval of_unix_fd :
?close_noerr:bool ->
closed:bool ref ->
buf:Slice.t ->
Unix.file_descr ->
tval of_slice : Slice.t -> tval iter : (bytes -> int -> int -> unit) -> t -> unitval to_chan : out_channel -> t -> unitval to_chan' : Iostream.Out.t -> t -> unitval read_exactly_ : too_short:(unit -> unit) -> t -> bytes -> int -> unitRead n bytes from the input into bytes.
val read_line_into : t -> buf:Buf.t -> unitread a line into the buffer, after clearing it.
val read_line_using : buf:Buf.t -> t -> stringval read_line_using_opt : buf:Buf.t -> t -> string optionnew stream with maximum size max_size.
New stream that consumes exactly size bytes from the input. If fewer bytes are read before close is called, we read and discard the remaining quota of bytes before close returns.
val output_chunked' : ?buf:Buf.t -> Iostream.Out_buf.t -> t -> unitOutput a stream using chunked encoding
val output_chunked : ?buf:Buf.t -> out_channel -> t -> unitprint a stream as a series of chunks