3 Encoding
procedure
(read-uint* [in max-size])
→ (or/c exact-nonnegative-integer? eof-object?) in : input-port? = (current-input-port) max-size : (or/c exact-positive-integer? #f) = 10
procedure
(write-uint* n [out max-size]) → void?
n : exact-nonnegative-integer? out : output-port? = (current-output-port) max-size : (or/c exact-positive-integer? #f) = 10
procedure
(read-sint* [in max-size]) → (or/c exact-integer? eof-object?)
in : input-port? = (current-input-port) max-size : (or/c exact-positive-integer? #f) = 10
procedure
(write-sint* i [out max-size]) → void?
i : exact-integer? out : output-port? = (current-output-port) max-size : (or/c exact-positive-integer? #f) = 10
procedure
(read-int* [in]) → (or/c exact-integer? eof-object?)
in : input-port? = (current-input-port)
procedure
(write-int* i [out]) → void?
i : exact-integer? out : output-port? = (current-output-port)
procedure
(read-bool [in]) → (or/c bool? eof-object?)
in : input-port? = (current-input-port)
procedure
(write-bool v [out]) → void?
v : any/c out : output-port? = (current-output-port)
procedure
(read-fixed32 [in])
→ (or/c exact-nonnegative-integer? eof-object?) in : input-port? = (current-input-port)
procedure
(read-fixed64 [in])
→ (or/c exact-nonnegative-integer? eof-object?) in : input-port? = (current-input-port)
procedure
(write-fixed32 n [out]) → void?
n : exact-nonnegative-integer? out : output-port? = (current-output-port)
procedure
(write-fixed64 n [out]) → void?
n : exact-nonnegative-integer? out : output-port? = (current-output-port)
procedure
(read-sfixed32 [in]) → (or/c exact-integer? eof-object?)
in : input-port? = (current-input-port)
procedure
(read-sfixed64 [in]) → (or/c exact-integer? eof-object?)
in : input-port? = (current-input-port)
procedure
(write-sfixed32 i [out]) → void?
i : exact-integer? out : output-port? = (current-output-port)
procedure
(write-sfixed64 i [out]) → void?
i : exact-integer? out : output-port? = (current-output-port)
procedure
(read-float [in]) → (or/c real? eof-object?)
in : input-port? = (current-input-port)
procedure
(read-double [in]) → (or/c real? eof-object?)
in : input-port? = (current-input-port)
procedure
(write-float x [out]) → void?
x : real? out : output-port? = (current-output-port)
procedure
(write-double x [out]) → void?
x : real? out : output-port? = (current-output-port)
procedure
(read-sized-bytes [in]) → (or/c bytes? eof-object?)
in : input-port? = (current-input-port)
procedure
(write-sized-bytes bstr [out]) → void?
bstr : bytes? out : output-port? = (current-output-port)
procedure
(read-sized-string [in]) → (or/c string? eof-object?)
in : input-port? = (current-input-port)
procedure
(write-sized-string str [out]) → void?
str : string? out : output-port? = (current-output-port)
procedure
(read-sized read [in]) → any/c
read : (-> input-port? any/c) in : input-port? = (current-input-port)
procedure
(write-sized write v [out]) → any
write : (-> any/c output-port? any) v : any/c out : output-port? = (current-output-port)
On input, read is called on an input port limited according to the size prefix. On output, write is called on v and a byte string output port; the buffered output’s length is then written to the actual output port.
procedure
(read-tag/type [in])
→
(or/c tag/c eof-object?) (or/c exact-nonnegative-integer? eof-object?) in : input-port? = (current-input-port)
procedure
(write-tag/type tag type [out]) → void?
tag : tag/c type : exact-nonnegative-integer? out : output-port? = (current-output-port)
value
type/c : flat-contract?
'int*: The field value is encoded as a variable length integer.
'64bit: The field value is always encoded in 64 bits.
'32bit: The field value is always encoded in 32 bits.
'sized: The field value is encoded with a byte size prefix.