Module encoder

Source
Expand description

Provides an implementation of the proto3 encoder.

The encoder performs the task of transforming data fields into shrunken binary format. This sequence of bytes is much smaller than the original message which allows for much faster data transmission over the wire.

Property names are represented in the [Protocol Buffers] by unique numbers rather than strings. Compared to the raw JSON format, this already has a significant impact on the final size of the message that is then sent over the wire.

+-------------------+------------------+-------------------+
+      1. JSON      +   2. Transform   +     3. Encode     + ENCODER
+-------------------+------------------+-------------------+
+ {                 +                  +                   +
+   "name": "John", + 1, John          + 0a 04 4a 6f 68 6e +
+   "age": 35       + 2, 35            + 10 23             +
+ }                 +                  +                   +
+-------------------+------------------+-------------------+
+      6. JSON      +    5. Rebuild    +     4. Decode     + DECODER
+-------------------+------------------+-------------------+

The encoder encodes a message into a binary format. The message is then represented on the wire as a kind of flattened sequence of encoded key-value properties. The key and the value are encoded separately. Each wire type has its own rules and therefore its own way of encoding.

[key1][value1][key2][value2] ... [keyN][valueN]

Structs§

Encoder
Provides the encoding engine for Protocol Buffers.

Enums§

EncoderError
Contains error options that can be encountered while performing the encoding operations.
EncoderLit
Provides encoder input format options.