/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// Write will do a new allocation and expand the size of the buffer if needed. // Returns the offset of the end of the write.
size_t Write(size_t index, const uint8_t* val, size_t count);
size_t Write(size_t index, const DataBuffer& buf) { return Write(index, buf.data(), buf.len());
}
// Write an integer, also performing host-to-network order conversion. // Returns the offset of the end of the write.
size_t Write(size_t index, uint32_t val, size_t count);
// Starting at |index|, remove |remove| bytes and replace them with the // contents of |buf|. void Splice(const DataBuffer& buf, size_t index, size_t remove = 0) {
Splice(buf.data(), buf.len(), index, remove);
}