Module Jsonxt__.Basic_stream
- type json_stream- = Jsonxt.Json_stream.Basic.json
Reader functions
include Jsonxt__.Reader_stream.Reader_stream with type json_stream := json_stream
json_stream_* and decode functions
- val json_stream_of_string : string -> stream
- json_stream_of_string screates a stream parser that returns a series of- json_streamelements from the string- s.
- val json_stream_of_channel : Stdlib.in_channel -> stream
- json_stream_of_channel iccreates a stream parser that returns a series of- json_streamelements from the- in_channel- ic.
- val json_stream_of_function : (bytes -> int -> int) -> stream
- json_stream_of_function fcreates a stream parser that returns a series of- json_streamelements from the reader function- f.- f buf lentakes a buffer- bufand maximum length- lenand returns the number of bytes read to a maximum of- len
- val decode_stream : stream -> (json_stream option, string) Stdlib.result
- decode_stream tdecode the next element of the input,- Ok Noneindicates 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 screates a- json_stream Stream.tfrom- json_stream_of_string sand- decode_stream
- val stream_from_channel : Stdlib.in_channel -> json_stream Stdlib.Stream.t
- stream_from_channel iccreates a- json_stream Stream.tfrom- json_stream_of_channel icand- decode_stream
- val stream_from_function : (bytes -> int -> int) -> json_stream Stdlib.Stream.t
- stream_from_function fcreates a- json_stream Stream.tfrom- json_stream_of_function fand- decode_stream
Writer functions
include Jsonxt__.Writer_stream_intf.Intf with type json_stream := json_stream
- val create_encoder' : add_char:(char -> unit) -> add_string:(string -> unit) -> incr:int -> eol:string -> t
- create_encoder' ~add_char ~add_string ~incr ~eolis the low level function used to create the various stream encoders. The- add_char cand- add_string sfunctions handle adding a- char- cand- string- sto the output respectively.- incrand- eolwork together to output human readable output.- incrdefines the increase in indentation and- eolthe end of line sequence. A type- tis returned
- val create_encoder : add_char:(char -> unit) -> add_string:(string -> unit) -> t
- create_encoder ~add_char ~add_stringcreates a compact encoder.- add_charand- add_stringadd a- charand- stringto the output respectively A type- tis returned
- val create_encoder_hum : add_char:(char -> unit) -> add_string:(string -> unit) -> t
- create_encoder_hum ~add_char ~add_stringcreates a human readable encoder.- add_charand- add_stringadd a- charand- stringto the output respectively. The increment is set to 2 and end of line to LF (\n). A type- tis returned
- val create_encoder_channel : Stdlib.out_channel -> t
- create_encoder_channel occreates a compact encoder outputing to channel- oc
- val create_encoder_channel_hum : Stdlib.out_channel -> t
- create_encoder_channel_hum occreates a human readable encoder outputing to channel- oc
- val encode_stream_exn : t -> json_stream -> unit
- encode_stream_exn t json_streamencodes and outputs the element- json_stream. Errors cause a Failure exception to be raised.
- val encode_stream : t -> json_stream -> (unit, string) Stdlib.result
- encode_stream_exn t json_streamencodes and outputs the element- json_stream. Errors are reported via the- resultvalue.