(assert-readable-bytes buffer expected)
Make sure that there are at least 'expected' more bytes to be read from the buffer. This is to protect against corrupt packets.
Make sure that there are at least 'expected' more bytes to be read from the buffer. This is to protect against corrupt packets.
(parse-flags in & kvs)
Decode a single byte of flags. Takes a list of pairs of keywords and bit-widths. All bit-widths must add up to 8. All 1-bit values are converted to boolean.
Example:
(parse-flags buffer :type 4, :duplicate 1, :qos 2, :retain 1)
Decode a single byte of flags. Takes a list of pairs of keywords and bit-widths. All bit-widths must add up to 8. All 1-bit values are converted to boolean. Example: (parse-flags buffer :type 4, :duplicate 1, :qos 2, :retain 1)
(parse-short-prefixed-bytes in)
Decode a short, then as many bytes as the short says.
Decode a short, then as many bytes as the short says.
(parse-string in)
Decode a utf-8 encoded string. Strings are preceeded by 2 bytes describing the length of the remaining content.
Decode a utf-8 encoded string. Strings are preceeded by 2 bytes describing the length of the remaining content.
(parse-unsigned-byte in)
Decode a single byte
Decode a single byte
(parse-unsigned-short in)
Decode an unsigned short
Decode an unsigned short
(unsigned-byte b)
Cast to unsigned byte. 256 is Byte/MAX_VALUE - Byte/MIN_VALUE.
Cast to unsigned byte. 256 is Byte/MAX_VALUE - Byte/MIN_VALUE.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close