Module Reader_stream.Make
Parameters
Signature
type json_stream
= Parser.Compliance.json_stream
type stream
json_stream_* and decode functions
val json_stream_of_string : string -> stream
json_stream_of_string s
creates a stream parser that returns a series ofjson_stream
elements from the strings
.
val json_stream_of_channel : Stdlib.in_channel -> stream
json_stream_of_channel ic
creates a stream parser that returns a series ofjson_stream
elements from thein_channel
ic
.
val json_stream_of_function : (bytes -> int -> int) -> stream
json_stream_of_function f
creates a stream parser that returns a series ofjson_stream
elements from the reader functionf
.f buf len
takes a bufferbuf
and maximum lengthlen
and returns the number of bytes read to a maximum oflen
val decode_stream : stream -> (json_stream option, string) Stdlib.result
decode_stream t
decode the next element of the input,Ok None
indicates end of the stream
Stream.t
functions
These functions provide a Stream.t
API on top of the json_stream_of_* and decode_stream functions.
val stream_from_string : string -> json_stream Stdlib.Stream.t
stream_from_string s
creates ajson_stream Stream.t
fromjson_stream_of_string s
anddecode_stream
val stream_from_channel : Stdlib.in_channel -> json_stream Stdlib.Stream.t
stream_from_channel ic
creates ajson_stream Stream.t
fromjson_stream_of_channel ic
anddecode_stream
val stream_from_function : (bytes -> int -> int) -> json_stream Stdlib.Stream.t
stream_from_function f
creates ajson_stream Stream.t
fromjson_stream_of_function f
anddecode_stream