Skip to content

Commit

Permalink
worked on :jsonl module
Browse files Browse the repository at this point in the history
  • Loading branch information
jlangch committed Oct 17, 2023
1 parent f2063a9 commit af035eb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class IOFunctionsSpitSlurp {
" * `java.nio.file.Path` \n" +
" * `java.net.URL` \n" +
" * `java.net.URI` \n\n" +
"Returns the a list of strings. \n\n" +
"Options: \n\n" +
"| :encoding enc | e.g.: `:encoding :utf-8`, defaults to :utf-8 | \n\n" +
"`io/slurp-lines` supports load paths. See the `loadpath/paths` " +
Expand Down Expand Up @@ -232,22 +233,24 @@ else if (Types.isVncJavaObject(arg, URI.class)) {
.meta()
.arglists("(io/slurp f & options)")
.doc(
"Reads the content of file f as text (string) or binary (bytebuf). \n\n" +
"f may be a: \n\n" +
" * string file path, e.g: \"/temp/foo.json\" \n" +
" * bytebuffer \n" +
" * `java.io.File`, e.g: `(io/file \"/temp/foo.json\")` \n" +
" * `java.io.InputStream` \n" +
" * `java.io.Reader` \n" +
" * `java.nio.file.Path` \n" +
" * `java.net.URL` \n" +
" * `java.net.URI` \n\n" +
"Options: \n\n" +
"| :binary true/false | e.g.: `:binary true`, defaults to false | \n" +
"| :encoding enc | e.g.: `:encoding :utf-8`, defaults to :utf-8 |\n\n" +
"`io/slurp` supports load paths. See the `loadpath/paths` " +
"doc for a description of the *load path* feature.\n\n" +
"Note: For HTTP and HTTPS downloads prefer to use `io/download`. ")
"Reads the content of file f as text (string) or binary (bytebuf). \n\n" +
"f may be a: \n\n" +
" * string file path, e.g: \"/temp/foo.json\" \n" +
" * bytebuffer \n" +
" * `java.io.File`, e.g: `(io/file \"/temp/foo.json\")` \n" +
" * `java.io.InputStream` \n" +
" * `java.io.Reader` \n" +
" * `java.nio.file.Path` \n" +
" * `java.net.URL` \n" +
" * `java.net.URI` \n\n" +
"Returns a `bytebuf` or string depending on the passed :binary " +
"option. \n\n" +
"Options: \n\n" +
"| :binary true/false | e.g.: `:binary true`, defaults to false | \n" +
"| :encoding enc | e.g.: `:encoding :utf-8`, defaults to :utf-8 | \n\n" +
"`io/slurp` supports load paths. See the `loadpath/paths` doc for a " +
"description of the *load path* feature. \n\n" +
"Note: For HTTP and HTTPS downloads prefer to use `io/download`. ")
.seeAlso(
"io/slurp-lines", "io/slurp-stream", "io/slurp-reader",
"io/spit", "io/download", "loadpath/paths")
Expand Down Expand Up @@ -514,12 +517,14 @@ else if (Types.isVncJavaObject(args.first(), Writer.class)) {
.meta()
.arglists("(io/slurp-stream is & options)")
.doc(
"Slurps binary or string data from a `java.io.InputStream` is. " +
"Supports the option :binary to either slurp binary or string data. " +
"For string data an optional encoding can be specified.\n\n" +
"Options: \n\n" +
"| :binary true/false | e.g.: `:binary true`, defaults to false |\n" +
"| :encoding enc | e.g.: `:encoding :utf-8`, defaults to :utf-8 |\n\n" +
"Slurps binary or string data from a `java.io.InputStream` is. " +
"Supports the option :binary to either slurp binary or string data. " +
"For string data an optional encoding can be specified. \n\n" +
"Returns the result as a `bytebuf` or string depending on the \n" +
"passed :binary option. \n\n" +
"Options: \n\n" +
"| :binary true/false | e.g.: `:binary true`, defaults to false | \n" +
"| :encoding enc | e.g.: `:encoding :utf-8`, defaults to :utf-8 | \n\n" +
"Note: \n\n" +
"`io/slurp-stream` offers the same functionality as `io/slurp` but it " +
"opens more flexibility with sandbox configuration. `io/slurp` can be " +
Expand Down
13 changes: 11 additions & 2 deletions src/main/resources/com/github/jlangch/venice/jsonl.venice
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

The out may be a:

* string file path, e.g: \"/temp/foo.json\"
* `java.io.File`, e.g: `(io/file \"/temp/foo.json\")`
* `java.nio.Path`
* `java.io.OutputStream`
Expand Down Expand Up @@ -142,8 +143,16 @@
(defn
^{ :arglists '("(jsonl/slurp in & options)")
:doc """
Slurps a list of JSON line strings and returns it as a list of Venice
datatypes.
Slurps a list of JSON line stringsfrom the input and returns it as a
list of Venice datatypes.

in may be a:
* string file path, e.g: \"/temp/foo.json\"
* bytebuffer
* `java.io.File`, e.g: `(io/file \"/temp/foo.json\")`
* `java.io.InputStream`
* `java.io.Reader`
* `java.nio.file.Path`

Options:

Expand Down

0 comments on commit af035eb

Please sign in to comment.