From 13ac722af7b3347205551189d6b5080b80a8e43b Mon Sep 17 00:00:00 2001 From: jlangch Date: Fri, 20 Oct 2023 10:48:51 +0200 Subject: [PATCH] updated doc --- doc/readme/json-lines.md | 21 +++++++++++++++++++-- doc/readme/json.md | 18 ++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/doc/readme/json-lines.md b/doc/readme/json-lines.md index fafe9abc7..220347f9b 100644 --- a/doc/readme/json-lines.md +++ b/doc/readme/json-lines.md @@ -45,7 +45,11 @@ converted. E.g. there is no real decimal type and Venice `int` is converted to ` ### Streams -JSON Lines can be spit to Java OutputStreams, Writers, or files +JSON can be spit to Java OutputStreams, Writers, or files: + * `io/bytebuf-out-stream` + * `io/file-out-stream` + * `io/buffered-writer` + * `io/file` ```clojure (do @@ -73,7 +77,20 @@ JSON Lines can be spit to Java OutputStreams, Writers, or files (flush wr))) ``` -JSON can be slurped from Java InputStreams, Readers, or files + +JSON can be slurped from byte buffers, Java InputStreams, Readers, or files: + * `bytebuf` + * `io/file-in-stream` + * `io/bytebuf-in-stream` + * `io/buffered-reader` + * `io/file` + +```clojure +(do + (load-module :jsonl) + + (jsonl/slurp (io/file "data.jsonl"))) +``` ```clojure (do diff --git a/doc/readme/json.md b/doc/readme/json.md index 1ef471a1d..a969625e1 100644 --- a/doc/readme/json.md +++ b/doc/readme/json.md @@ -23,7 +23,11 @@ converted. E.g. there is no real decimal type and Venice `int` is converted to ` ### Streams -JSON can be spit to Java OutputStreams, Writers, or files +JSON can be spit to Java OutputStreams, Writers, or files: + * `io/bytebuf-out-stream` + * `io/file-out-stream` + * `io/buffered-writer` + * `io/file` ```clojure (let [out (io/bytebuf-out-stream)] @@ -33,7 +37,17 @@ JSON can be spit to Java OutputStreams, Writers, or files ;;=> "{\"a\":100,\"b\":100,\"c\":[10,20,30]}" ``` -JSON can be slurped from Java InputStreams, Readers, or files + +JSON can be slurped from byte buffers, Java InputStreams, Readers, or files: + * `bytebuf` + * `io/file-in-stream` + * `io/bytebuf-in-stream` + * `io/buffered-reader` + * `io/file` + +```clojure +(json/slurp (io/file "data.jsonl")) +``` ```clojure (let [json (json/write-str {:a 100 :b 100})]