23 #include "../encoding/buffer-stream.hpp" 24 #include "../security/transform.hpp" 50 catch (
const t::Error&) {
55 return make_optional<Block>(os.
buf());
60 catch (
const std::invalid_argument&) {
82 BOOST_THROW_EXCEPTION(
Error(
"unrecognized IoEncoding"));
85 catch (
const t::Error& e) {
86 BOOST_THROW_EXCEPTION(
Error(e.what()));
optional< Block > loadBlock(std::istream &is, IoEncoding encoding)
loads a TLV block from a stream
constexpr nullopt_t nullopt
void saveBlock(const Block &block, std::ostream &os, IoEncoding encoding)
saves a TLV block to a stream
Copyright (c) 2013-2017 Regents of the University of California.
Represents a TLV element of NDN packet format.
size_t size() const
Get size of encoded wire, including Type-Length-Value.
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer.
const uint8_t * wire() const
Get pointer to encoded wire.
implements an output stream that constructs ndn::Buffer
represents an error in TLV encoding or decoding
IoEncoding
indicates how a file or stream is encoded