(->options opts)
Build an Options object out from a map or nil.
Build an Options object out from a map or nil.
(decode decoder)
Decode a single object from the decoder. When no items left, return an instance of EOF object.
Decode a single object from the decoder. When no items left, return an instance of EOF object.
(decode-from src)
(decode-from src options)
Decode a single value from the src
source (a file,
an input stream, etc).
Decode a single value from the `src` source (a file, an input stream, etc).
(decode-seq d)
Get a lazy sequence of decoded values out from
a Decoder
instance.
Get a lazy sequence of decoded values out from a `Decoder` instance.
(decode-seq-from src)
(decode-seq-from src options)
Encode multiple values from the src
source as
a vector.
Encode multiple values from the `src` source as a vector.
(decoder src)
(decoder src options)
Make a Decoder
instance. The src
is anything
that can be transformed into an InputStream
using the io/input-stream
function. The options
is either a Clojure map or nil.
Make a `Decoder` instance. The `src` is anything that can be transformed into an `InputStream` using the `io/input-stream` function. The `options` is either a Clojure map or nil.
(encode-seq encoder coll)
Encode a sequence of objects so they can be read one by one later on. Return the number of objects written.
Encode a sequence of objects so they can be read one by one later on. Return the number of objects written.
(encode-seq-to xs out)
(encode-seq-to xs out options)
Encode multiple values into the out
destination.
Return a number of values written.
Encode multiple values into the `out` destination. Return a number of values written.
(encode-seq-to-bytes xs)
(encode-seq-to-bytes xs options)
Encode multiple values into a byte array.
Encode multiple values into a byte array.
(encode-to x out)
(encode-to x out options)
Encode a single value into the out
destination
(a file, a stream, etc).
Encode a single value into the `out` destination (a file, a stream, etc).
(encode-to-bytes x)
(encode-to-bytes x options)
Encode a single value into a byte array.
Encode a single value into a byte array.
(encoder out)
(encoder out options)
Make an Encoder
instance. The out
is anything
that can be transformed into an OutputStream
using the io/output-stream
function. The options
is either a Clojure map or nil.
Make an `Encoder` instance. The `out` is anything that can be transformed into an `OutputStream` using the `io/output-stream` function. The `options` is either a Clojure map or nil.
(expand-decode [OID decoder] & body)
A helper macro to expand decoding logic for a certain numeric code.
Arguments:
OID
is a Short unique number describing the type;decoder
is a symbol bound to the current Decoder
instance.The body must read fields by calling either top-level decode
function or low-level .readInteger
, .readString
, and other
methods, and construct the final value out from them.
A helper macro to expand decoding logic for a certain numeric code. Arguments: - the `OID` is a Short unique number describing the type; - the `decoder` is a symbol bound to the current `Decoder` instance. The body must read fields by calling either top-level `decode` function or low-level `.readInteger`, `.readString`, and other methods, and construct the final value out from them.
(expand-encode [OID Type encoder value] & body)
A helper macro to expand encoding logic for a certain type.
Arguments:
OID
is a Short unique number describing the type;Type
is a class;encoder
is a symbol bound to the current Encoder
instance;value
is a symbol bound to the current instance
of class Type
.The body must encode inner fields of the object using
ether top-level encode
function or by calling the low-level
.writeInt
, .writeString
, and other methods.
A helper macro to expand encoding logic for a certain type. Arguments: - the `OID` is a Short unique number describing the type; - the `Type` is a class; - the `encoder` is a symbol bound to the current `Encoder` instance; - the `value` is a symbol bound to the current instance of class `Type`. The body must encode inner fields of the object using ether top-level `encode` function or by calling the low-level `.writeInt`, `.writeString`, and other methods.
(handle-record OID RecordClass)
Extend both encode & decode logic so they support a custom defrecord class. Specify the custom OID number and the class object.
Usage:
(defrecord MyCustomRecord [id size sku] ...)
(handle-record 0x1234 MyCustomRecord)
Extend both encode & decode logic so they support a custom defrecord class. Specify the custom OID number and the class object. Usage: (defrecord MyCustomRecord [id size sku] ...) (handle-record 0x1234 MyCustomRecord)
(header? x)
True if the object is a Header instance.
True if the object is a Header instance.
(unsupported? x)
True if the object is Unsupported.
True if the object is Unsupported.
(version decoder)
Return a version number used in the decoder.
Return a version number used in the decoder.
(with-decoder [bind src options] & body)
Perform the body binding the new Decoder
object
to the bind
symbol. The src
object gets coerced
to the input stream. Both encoder and the src
object get closed afterwards.
Perform the body binding the new `Decoder` object to the `bind` symbol. The `src` object gets coerced to the input stream. Both encoder and the `src` object get closed afterwards.
(with-encoder [bind out options] & body)
Perform the body binding the new Encoder
object
to the bind
symbol. The out
object gets coerced
to the output stream. Both encoder and the out
object get closed afterwards.
Perform the body binding the new `Encoder` object to the `bind` symbol. The `out` object gets coerced to the output stream. Both encoder and the `out` object get closed afterwards.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close