(clojure-decoder &
{:keys [data-readers default-data-reader-fn encoding features
read-cond read-eval]})
Returns a function that takes a source and returns a reducible that, opens the source as a java.io.PushbackReader, repeatedly decodes Clojure data from it, and closes it when it is done.
The decoder opens the source as a java.io.PushbackReader. If the source is already a PushbackReader, then it is used without modification. If it is not a PushbackReader, then it is given to clojure.java.io/reader with the encoding (if specified) and then wrapped in a PushbackReader.
If features or read-cond are specified, they are given as options to clojure.core/read.
If data-readers, default-data-readers-fn, or read-eval are given they are bound to data-readers, default-data-reader-fn, and read-eval (respectively) for the duration of the reduction/transduction.
See decoder, edn-decoder, reader-decoder, and stream-decoder.
Returns a function that takes a source and returns a reducible that, opens the source as a java.io.PushbackReader, repeatedly decodes Clojure data from it, and closes it when it is done. The decoder opens the source as a java.io.PushbackReader. If the source is already a PushbackReader, then it is used without modification. If it is not a PushbackReader, then it is given to clojure.java.io/reader with the encoding (if specified) and then wrapped in a PushbackReader. If features or read-cond are specified, they are given as options to clojure.core/read. If data-readers, default-data-readers-fn, or read-eval are given they are bound to *data-readers*, *default-data-reader-fn*, and *read-eval* (respectively) for the duration of the reduction/transduction. See decoder, edn-decoder, reader-decoder, and stream-decoder.
(clojure-encoder & {:keys [encoding append]})
Returns a function that takes either a sink and a source, reducing the source as Clojure data into the sink, or a sink, a transducer, and a source, transducing the source as Clojure data into the sink through the transducer. This is an analog of into but for Clojure data into a java.io.Writer.
The encoder opens the sink with clojure.java.io/writer. If encoding or append are given, then they are passed along to clojure.java.io/writer.
The data from the source (or the transducer applied to the source) is written to the sink using prn-str.
When the reduction/transduction completes whether normally, early (someone returns a reduced), or because of an exception, then the stream is closed.
See encoder, stream-encoder, and writer-encoder
Returns a function that takes either a sink and a source, reducing the source as Clojure data into the sink, or a sink, a transducer, and a source, transducing the source as Clojure data into the sink through the transducer. This is an analog of into but for Clojure data into a java.io.Writer. The encoder opens the sink with clojure.java.io/writer. If encoding or append are given, then they are passed along to clojure.java.io/writer. The data from the source (or the transducer applied to the source) is written to the sink using prn-str. When the reduction/transduction completes whether normally, early (someone returns a reduced), or because of an exception, then the stream is closed. See encoder, stream-encoder, and writer-encoder
(decoder open decode done?)
(decoder open decode done? close)
Returns a function that takes a source and returns a reducible that, opens the source, repeatedly decodes data from it, and closes it when it is done.
open takes the source and returns a stateful, mutable object that will be given to decode and eventually to close.
decode is given the opened source and must return either a decoded value or a sentinel indicating there is no more data.
done? is given each decoded value and if it returns truthy, then the decoding ends.
When the reduction completes whether normally, early (someone returns a reduced), or because of an exception, then close is called.
If close is not given, then it defaults to java.lang.AutoCloseable/.close.
See stream-decoder and reader-decoder.
Returns a function that takes a source and returns a reducible that, opens the source, repeatedly decodes data from it, and closes it when it is done. open takes the source and returns a stateful, mutable object that will be given to decode and eventually to close. decode is given the opened source and must return either a decoded value or a sentinel indicating there is no more data. done? is given each decoded value and if it returns truthy, then the decoding ends. When the reduction completes whether normally, early (someone returns a reduced), or because of an exception, then close is called. If close is not given, then it defaults to java.lang.AutoCloseable/.close. See stream-decoder and reader-decoder.
(edn-decoder & {:keys [default encoding readers]})
Returns a function that takes a source and returns a reducible that, opens the source as a java.io.PushbackReader, repeatedly decodes EDN data from it, and closes it when it is done.
The decoder opens the source as a java.io.PushbackReader. If the source is already a PushbackReader, then it is used without modification. If it is not a PushbackReader, then it is given to clojure.java.io/reader with the encoding (if specified) and then wrapped in a PushbackReader.
If default or readers are specified, they are given as options to clojure.edn/read.
See decoder, clojure-decoder, reader-decoder, and stream-decoder.
Returns a function that takes a source and returns a reducible that, opens the source as a java.io.PushbackReader, repeatedly decodes EDN data from it, and closes it when it is done. The decoder opens the source as a java.io.PushbackReader. If the source is already a PushbackReader, then it is used without modification. If it is not a PushbackReader, then it is given to clojure.java.io/reader with the encoding (if specified) and then wrapped in a PushbackReader. If default or readers are specified, they are given as options to clojure.edn/read. See decoder, clojure-decoder, reader-decoder, and stream-decoder.
(encoder open encode!)
(encoder open encode! close)
Returns a function that takes either a sink and a source, reducing the source into the sink, or a sink, a transducer, and a source, transducing the source into the sink through the transducer. This is an analog of into but for a mutable sink.
open takes the sink and returns a stateful, mutable object that will be given to encode! and eventually to close.
encode! is given the opened sink and a value and must mutate the sink with the value. The return value from encode! is ignored.
When the reduction/transduction completes whether normally, early (someone returns a reduced), or because of an exception, then close is called.
If close is not given, then it defaults to java.lang.AutoCloseable/.close.
See clojure-encoder, stream-encoder, and writer-encoder
Returns a function that takes either a sink and a source, reducing the source into the sink, or a sink, a transducer, and a source, transducing the source into the sink through the transducer. This is an analog of into but for a mutable sink. open takes the sink and returns a stateful, mutable object that will be given to encode! and eventually to close. encode! is given the opened sink and a value and must mutate the sink with the value. The return value from encode! is ignored. When the reduction/transduction completes whether normally, early (someone returns a reduced), or because of an exception, then close is called. If close is not given, then it defaults to java.lang.AutoCloseable/.close. See clojure-encoder, stream-encoder, and writer-encoder
(reader-decoder decode done?)
(reader-decoder decode done? encoding)
Returns a function that takes a source and returns a reducible that, opens the source as a java.io.Reader, repeatedly decodes data from it, and closes it when it is done.
The decoder opens the source with clojure.java.io/reader. If encoding is given, then it is passed along to clojure.java.io/reader.
decode is given the opened source and must return either a decoded value or a sentinel indicating there is no more data.
done? is given each decoded value and if it returns truthy, then the decoding ends.
The decoder closes the source with java.lang.AutoCloseable/.close.
See decoder, clojure-decoder, edn-decoder, and stream-decoder.
Returns a function that takes a source and returns a reducible that, opens the source as a java.io.Reader, repeatedly decodes data from it, and closes it when it is done. The decoder opens the source with clojure.java.io/reader. If encoding is given, then it is passed along to clojure.java.io/reader. decode is given the opened source and must return either a decoded value or a sentinel indicating there is no more data. done? is given each decoded value and if it returns truthy, then the decoding ends. The decoder closes the source with java.lang.AutoCloseable/.close. See decoder, clojure-decoder, edn-decoder, and stream-decoder.
(stream-decoder decode done?)
Returns a function that takes a source and returns a reducible that, opens the source as a java.io.InputStream, repeatedly decodes data from it, and closes it when it is done.
The decoder opens the source with clojure.java.io/input-stream.
decode is given the opened source and must return either a decoded value or a sentinel indicating there is no more data.
done? is given each decoded value and if it returns truthy, then the decoding ends.
The decoder closes the source with java.lang.AutoCloseable/.close.
See decoder, clojure-decoder, edn-decoder, and reader-decoder.
Returns a function that takes a source and returns a reducible that, opens the source as a java.io.InputStream, repeatedly decodes data from it, and closes it when it is done. The decoder opens the source with clojure.java.io/input-stream. decode is given the opened source and must return either a decoded value or a sentinel indicating there is no more data. done? is given each decoded value and if it returns truthy, then the decoding ends. The decoder closes the source with java.lang.AutoCloseable/.close. See decoder, clojure-decoder, edn-decoder, and reader-decoder.
(stream-encoder)
(stream-encoder append)
Returns a function that takes either a sink and a source, reducing the source into the sink, or a sink, a transducer, and a source, transducing the source into the sink through the transducer. This is an analog of into but for a java.io.OutputStream.
The encoder opens the sink with clojure.java.io/output-stream. If append is given, then it is passed along to clojure.java.io/output-stream.
The source (or the transducer applied to the source) must return byte arrays which are written to the output stream.
When the reduction/transduction completes whether normally, early (someone returns a reduced), or because of an exception, then the stream is closed.
See encoder, clojure-encoder, and writer-encoder
Returns a function that takes either a sink and a source, reducing the source into the sink, or a sink, a transducer, and a source, transducing the source into the sink through the transducer. This is an analog of into but for a java.io.OutputStream. The encoder opens the sink with clojure.java.io/output-stream. If append is given, then it is passed along to clojure.java.io/output-stream. The source (or the transducer applied to the source) must return byte arrays which are written to the output stream. When the reduction/transduction completes whether normally, early (someone returns a reduced), or because of an exception, then the stream is closed. See encoder, clojure-encoder, and writer-encoder
(writer-encoder)
(writer-encoder append)
Returns a function that takes either a sink and a source, reducing the source into the sink, or a sink, a transducer, and a source, transducing the source into the sink through the transducer. This is an analog of into but for a java.io.Writer.
The encoder opens the sink with clojure.java.io/writer. If append is given, then it is passed along to clojure.java.io/writer.
The source (or the transducer applied to the source) must return Strings which are written to the output stream.
When the reduction/transduction completes whether normally, early (someone returns a reduced), or because of an exception, then the stream is closed.
See encoder, clojure-encoder, and stream-encoder
Returns a function that takes either a sink and a source, reducing the source into the sink, or a sink, a transducer, and a source, transducing the source into the sink through the transducer. This is an analog of into but for a java.io.Writer. The encoder opens the sink with clojure.java.io/writer. If append is given, then it is passed along to clojure.java.io/writer. The source (or the transducer applied to the source) must return Strings which are written to the output stream. When the reduction/transduction completes whether normally, early (someone returns a reduced), or because of an exception, then the stream is closed. See encoder, clojure-encoder, and stream-encoder
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close