CCIO.read_all now with ?size parameter

This commit is contained in:
Simon Cruanes 2014-12-16 22:52:18 +01:00
parent f229973ee3
commit 8f5fc7334d
2 changed files with 5 additions and 4 deletions

View file

@ -116,8 +116,8 @@ let read_lines_l ic =
with End_of_file ->
List.rev !l
let read_all ic =
let buf = ref (Bytes.create 256) in
let read_all ?(size=1024) ic =
let buf = ref (Bytes.create size) in
let len = ref 0 in
try
while true do

View file

@ -83,8 +83,9 @@ val read_lines : in_channel -> string gen
val read_lines_l : in_channel -> string list
(** Read all lines into a list *)
val read_all : in_channel -> string
(** Read the whole channel into a buffer, then converted into a string *)
val read_all : ?size:int -> in_channel -> string
(** Read the whole channel into a buffer, then converted into a string.
@param size the internal buffer size @since NEXT_RELEASE *)
(** {6 Output} *)