55 catch (
const t::Error& e) {
66 return make_optional<Block>(
loadBuffer(is, encoding));
68 catch (
const std::invalid_argument&) {
71 catch (
const std::runtime_error&) {
94 catch (
const t::Error& e) {
optional< Block > loadBlock(std::istream &is, IoEncoding encoding)
Reads a TLV block from a stream.
#define NDN_THROW_NESTED(e)
void saveBlock(const Block &block, std::ostream &os, IoEncoding encoding)
Writes a TLV block to a stream.
std::string to_string(const T &val)
const uint8_t * wire() const
Return a raw pointer to the beginning of the encoded wire.
Represents a TLV element of NDN packet format.
void saveBuffer(const uint8_t *buf, size_t size, std::ostream &os, IoEncoding encoding)
Writes a byte buffer to a stream.
size_t size() const
Return the size of the encoded wire, i.e.
Raw binary, without encoding.
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer.
implements an output stream that constructs ndn::Buffer
const nullopt_t nullopt((nullopt_t::init()))
shared_ptr< Buffer > loadBuffer(std::istream &is, IoEncoding encoding)
Reads bytes from a stream until EOF.
IoEncoding
Indicates how a file or stream of bytes is encoded.