28 explicit ReadBuffer(
const uint8_t *buf,
size_t sz)
29 : buf_(buf), size_(sz), next_(0) {}
31 explicit ReadBuffer(
const std::vector<uint8_t> &v)
32 : ReadBuffer(v.data(), v.size()) {}
35 ReadBuffer(
const ReadBuffer &) =
delete;
38 bool have(
size_t n)
const {
return remaining() >= n; }
40 size_t remaining()
const {
41 check(next_ <= size_,
"next_ <= size_");
45 const uint8_t *next(
size_t n) {
46 check(have(n),
"have(n)");
47 const uint8_t *p = &buf_[next_];
52 void next(
size_t n, uint8_t dest[]) {
53 const uint8_t *p = next(n);
54 for (
size_t i = 0; i < n; ++i) {