Liking cljdoc? Tell your friends :D

clj-cbor.core

Core CBOR library API.

Core CBOR library API.
raw docstring

cbor-codecclj

(cbor-codec & opts)

Construct a new CBOR codec with no configuration. Note that this does not include any read and write handlers. See the default-codec and the default-read-handlers and default-write-handlers vars.

Arguments may be a map or a sequence of key/value pairs. Valid options are:

  • :write-dispatch function which is called to provide a dispatch value based on the data to be rendered. (default: class)
  • :write-handlers lookup function from dispatch values to handlers which take some data to be encoded and return a transformed version of it (typically a tagged value).
  • :read-handlers lookup function from integer tags to handlers which take the embedded item and return the parsed data value.
Construct a new CBOR codec with no configuration. Note that this does not
include **any** read and write handlers. See the `default-codec` and the
`default-read-handlers` and `default-write-handlers` vars.

Arguments may be a map or a sequence of key/value pairs. Valid options are:

- `:write-dispatch` function which is called to provide a dispatch value
  based on the data to be rendered. (default: `class`)
- `:write-handlers` lookup function from dispatch values to handlers which
  take some data to be encoded and return a transformed version of it
  (typically a tagged value).
- `:read-handlers` lookup function from integer tags to handlers which take
  the embedded item and return the parsed data value.
raw docstring

decodeclj

(decode input)
(decode decoder input)
(decode decoder input eof-guard)

Decode a single CBOR value from the input.

The input may be a byte array or coercible to an input-stream. Uses the default-codec if none is provided. If at the end of the input, returns nil or eof-guard if provided.

Decode a single CBOR value from the input.

The input may be a byte array or coercible to an `input-stream`. Uses the
`default-codec` if none is provided. If at the end of the input, returns nil
or `eof-guard` if provided.
raw docstring

decode-seqclj

(decode-seq input)
(decode-seq decoder input)

Decode a sequence of CBOR values from the input.

The input may be a byte array or coercible to an input-stream. Uses the default-codec if none is provided. This returns a lazy sequence, so take care that the input stream is not closed before the entries are realized.

Decode a sequence of CBOR values from the input.

The input may be a byte array or coercible to an `input-stream`. Uses the
`default-codec` if none is provided. This returns a lazy sequence, so take
care that the input stream is not closed before the entries are realized.
raw docstring

default-codecclj

Default CBOR codec to use when none is specified.

Default CBOR codec to use when none is specified.
raw docstring

default-read-handlersclj

Map of default tag handlers to use, keyed by tag.

The default choice of representation for instants in time is java.time.Instant.

Map of default tag handlers to use, keyed by tag.

The default choice of representation for instants in time is
`java.time.Instant`.
raw docstring

default-write-handlersclj

Map of default write handlers to use, keyed by class.

The default choice of encoding for instants in time is the numeric epoch representation (tag 1).

Map of default write handlers to use, keyed by class.

The default choice of encoding for instants in time is the numeric epoch
representation (tag 1).
raw docstring

encodeclj

(encode value)
(encode encoder value)
(encode encoder output value)

Encode a single value as CBOR data.

In the full argument form, this writes a value to an output stream and returns the number of bytes written. If output is omitted, the function returns a byte array instead. Uses the default-codec if none is provided.

Encode a single value as CBOR data.

In the full argument form, this writes a value to an output stream and
returns the number of bytes written. If output is omitted, the function
returns a byte array instead. Uses the `default-codec` if none is provided.
raw docstring

encode-seqclj

(encode-seq values)
(encode-seq encoder values)
(encode-seq encoder output values)

Encode a sequence of values as CBOR data. This eagerly consumes the input sequence.

In the full argument form, this writes a value to an output stream and returns the number of bytes written. If output is omitted, the function returns a byte array instead. Uses the default-codec if none is provided.

Encode a sequence of values as CBOR data. This eagerly consumes the
input sequence.

In the full argument form, this writes a value to an output stream and
returns the number of bytes written. If output is omitted, the function
returns a byte array instead. Uses the `default-codec` if none is provided.
raw docstring

self-describeclj

(self-describe value)

Wraps a value with a self-describing CBOR tag. This will cause the first few bytes of the data to be D9D9F7, which serves as a distinguishing header for format detection.

Wraps a value with a self-describing CBOR tag. This will cause the first few
bytes of the data to be `D9D9F7`, which serves as a distinguishing header for
format detection.
raw docstring

slurpclj

(slurp f & opts)

Opens an input stream from f, reads the first value from it, then closes the stream.

Opens an input stream from `f`, reads the first value from it, then closes
the stream.
raw docstring

slurp-allclj

(slurp-all f & opts)

Opens an input stream from f, reads all values from it, then closes the stream.

Opens an input stream from `f`, reads all values from it, then closes the
stream.
raw docstring

spitclj

(spit f value & opts)

Opens an output stream to f, writes value to it, then closes the stream.

Options may include :append to write to the end of the file instead of truncating.

Opens an output stream to `f`, writes `value` to it, then closes the stream.

Options may include `:append` to write to the end of the file instead of
truncating.
raw docstring

spit-allclj

(spit-all f values & opts)

Opens an output stream to f, writes each element in values to it, then closes the stream.

Options may include :append to write to the end of the file instead of truncating.

Opens an output stream to `f`, writes each element in `values` to it, then
closes the stream.

Options may include `:append` to write to the end of the file instead of
truncating.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close