Liking cljdoc? Tell your friends :D

clj-protobuf.core

Serialization, on top of what the generated code produces.

Generated X->proto / proto->X fns are Message-in/Message-out — they never touch bytes. This namespace is the other half: Message to bytes and back.

Typical round trip:

(-> rec HelloRequest->proto pb/encode)                     ; -> bytes
(->> bytes (pb/decode HelloRequest-prototype) proto->HelloRequest)

decode takes the generated X-prototype var — the same value everything else in the contract keys off — so there is exactly one handle per message type in user code.

Serialization, on top of what the generated code produces.

Generated `X->proto` / `proto->X` fns are Message-in/Message-out — they never
touch bytes. This namespace is the other half: Message to bytes and back.

Typical round trip:

    (-> rec HelloRequest->proto pb/encode)                     ; -> bytes
    (->> bytes (pb/decode HelloRequest-prototype) proto->HelloRequest)

`decode` takes the generated `X-prototype` var — the same value everything
else in the contract keys off — so there is exactly one handle per message
type in user code.
raw docstring

decodeclj

(decode prototype input)

Parse one message. prototype is the generated X-prototype var; input is a byte array, ByteString, ByteBuffer, or InputStream (read to the end).

Parse one message. `prototype` is the generated `X-prototype` var; `input`
is a byte array, ByteString, ByteBuffer, or InputStream (read to the end).
sourceraw docstring

decode-delimitedclj

(decode-delimited prototype in)

Parse one length-prefixed message from a stream; nil at end of stream.

Parse one length-prefixed message from a stream; nil at end of stream.
sourceraw docstring

encodeclj

(encode msg)
(encode msg out)

Message -> bytes. With an OutputStream, writes to it and returns it.

Message -> bytes. With an OutputStream, writes to it and returns it.
sourceraw docstring

encode-delimitedclj

(encode-delimited msg out)

Write msg length-prefixed, for framed streams of messages.

Write msg length-prefixed, for framed streams of messages.
sourceraw docstring

unknown-fieldsclj

(unknown-fields msg)

The unknown fields protobuf-java preserved on a parsed Message. Preserved on the Message; necessarily dropped by a record round trip (proto->X reads declared fields only), so re-encoding a record is not byte-identical to the original when unknown fields were present. Inspect them here when that matters.

The unknown fields protobuf-java preserved on a parsed Message. Preserved on
the Message; necessarily dropped by a record round trip (`proto->X` reads
declared fields only), so re-encoding a record is not byte-identical to the
original when unknown fields were present. Inspect them here when that
matters.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close