Liking cljdoc? Tell your friends :D

clj-protobuf.impl.wire

Wire primitives for the compiled codec: one writer and one reader per field, built once from the field's type and number, over protobuf-java's own CodedOutputStream and CodedInputStream. Varints, zigzag, fixed widths, UTF-8 and the length arithmetic stay protobuf-java's code; what this namespace adds is the choice of which call to make, made once per field instead of once per value.

A writer writes one field — tag included, every element for repeateds, one length-delimited run when packed — and reports its serialized size. A reader is handed the input positioned just after this field's tag and the slot's current value, and returns the slot's new value: the scalar, the list with one more element, the map with one more entry, or a merged message when a singular message field repeats on the wire. Readers are keyed by tag rather than by field number upstream, because a repeated scalar may arrive packed or expanded whatever its descriptor says it writes, and the two are different tags.

Slot representations, shared with the compiler and the codec: int32 kinds Integer int64 kinds Long float Float double Double bool Boolean string String bytes ByteString enum Integer (the number) message Message repeated java.util.ArrayList map java.util.LinkedHashMap (insertion order is wire order)

Wire primitives for the compiled codec: one writer and one reader per
field, built once from the field's type and number, over protobuf-java's
own CodedOutputStream and CodedInputStream. Varints, zigzag, fixed widths,
UTF-8 and the length arithmetic stay protobuf-java's code; what this
namespace adds is the choice of which call to make, made once per field
instead of once per value.

A writer writes one field — tag included, every element for repeateds, one
length-delimited run when packed — and reports its serialized size. A
reader is handed the input positioned just after this field's tag and the
slot's current value, and returns the slot's new value: the scalar, the
list with one more element, the map with one more entry, or a merged
message when a singular message field repeats on the wire. Readers are
keyed by tag rather than by field number upstream, because a repeated
scalar may arrive packed or expanded whatever its descriptor says it
writes, and the two are different tags.

Slot representations, shared with the compiler and the codec:
  int32 kinds  Integer      int64 kinds  Long
  float        Float        double       Double
  bool         Boolean      string       String
  bytes        ByteString   enum         Integer (the number)
  message      Message      repeated     java.util.ArrayList
  map          java.util.LinkedHashMap (insertion order is wire order)
raw docstring

map-reader*clj

(map-reader* key-type key-opts key-default val-type val-opts val-default)

A reader for a map field. val-opts are the value's scalar-reader opts, or {:parser IDeref} for message values. Defaults fill a missing key or value: key-default and val-default in slot representation, either of which may be an IDeref resolved on first use.

A reader for a map field. val-opts are the value's scalar-reader opts,
or {:parser IDeref} for message values. Defaults fill a missing key or
value: key-default and val-default in slot representation, either of
which may be an IDeref resolved on first use.
sourceraw docstring

map-writer*clj

(map-writer* n key-type val-type)

A writer for a map field: key-type and val-type are type names, the value side may be a message (val-parser nil then) — messages in maps are always length-delimited.

A writer for a map field: key-type and val-type are type names, the value
side may be a message (val-parser nil then) — messages in maps are always
length-delimited.
sourceraw docstring

message-reader*clj

(message-reader* n mode group? parser)

A reader for a message- or group-typed field; parser is an IDeref of the nested type's Parser.

A reader for a message- or group-typed field; parser is an IDeref of the
nested type's Parser.
sourceraw docstring

message-writerclj

(message-writer n mode group?)

A writer for a message- or group-typed field. group? selects start/end group tags (proto2 groups, editions DELIMITED).

A writer for a message- or group-typed field. group? selects start/end
group tags (proto2 groups, editions DELIMITED).
sourceraw docstring

read!clj

(read! r in current unknown)
source

scalar-readerclj

(scalar-reader type-name mode {:keys [utf8? known? field-number]})

A reader for a scalar field of this type name. mode is :singular, :expanded or :packed. opts: :utf8? for strings; for closed enums :known? (a predicate on the number) and :field-number, so undeclared numbers can be routed to unknown fields.

A reader for a scalar field of this type name. mode is :singular,
:expanded or :packed. opts: :utf8? for strings; for closed enums :known?
(a predicate on the number) and :field-number, so undeclared numbers can
be routed to unknown fields.
sourceraw docstring

scalar-writerclj

(scalar-writer type-name n mode)

A writer for a scalar (non-message) field of this type name and number. mode is :singular, :expanded (one tag per element) or :packed.

A writer for a scalar (non-message) field of this type name and number.
mode is :singular, :expanded (one tag per element) or :packed.
sourceraw docstring

size-ofclj

(size-of w v)
source

tagclj

(tag field-number wire-type)

WireFormat.makeTag, which is package-private — with the int overflow readTag has: the largest field number's tags are negative, and a table keyed by tag must key them the way they arrive.

WireFormat.makeTag, which is package-private — with the int overflow
readTag has: the largest field number's tags are negative, and a table
keyed by tag must key them the way they arrive.
sourceraw docstring

wire-typeclj

(wire-type type-name)

The wire type a field's type serializes with, as WireFormat's constant.

The wire type a field's type serializes with, as WireFormat's constant.
sourceraw docstring

write!clj

(write! w out v)
source

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