folly::bser::decodePduLength

Determine how much data is needed to fully decode a BSER pdu.

Synopsis

Declared in <folly/json/bser/Bser.h>

size_t
decodePduLength(folly::IOBuf const* buf);

Description

When reading incrementally, it is useful to know how much data to read to fully decode a BSER pdu.

Exceptions

NameThrown on
std::out_of_rangeif more data needs to be read to decode the header, or a runtime_error if the header is invalid.

Return Value

The total length in bytes of the encoded pdu.

Parameters

NameDescription
bufThe buffer holding the start of a BSER pdu.