mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
CCIO.read_all now with ?size parameter
This commit is contained in:
parent
f229973ee3
commit
8f5fc7334d
2 changed files with 5 additions and 4 deletions
|
|
@ -116,8 +116,8 @@ let read_lines_l ic =
|
||||||
with End_of_file ->
|
with End_of_file ->
|
||||||
List.rev !l
|
List.rev !l
|
||||||
|
|
||||||
let read_all ic =
|
let read_all ?(size=1024) ic =
|
||||||
let buf = ref (Bytes.create 256) in
|
let buf = ref (Bytes.create size) in
|
||||||
let len = ref 0 in
|
let len = ref 0 in
|
||||||
try
|
try
|
||||||
while true do
|
while true do
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,9 @@ val read_lines : in_channel -> string gen
|
||||||
val read_lines_l : in_channel -> string list
|
val read_lines_l : in_channel -> string list
|
||||||
(** Read all lines into a list *)
|
(** Read all lines into a list *)
|
||||||
|
|
||||||
val read_all : in_channel -> string
|
val read_all : ?size:int -> in_channel -> string
|
||||||
(** Read the whole channel into a buffer, then converted into a string *)
|
(** Read the whole channel into a buffer, then converted into a string.
|
||||||
|
@param size the internal buffer size @since NEXT_RELEASE *)
|
||||||
|
|
||||||
(** {6 Output} *)
|
(** {6 Output} *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue