Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
compression.cpp
Go to the documentation of this file.
1
#include <
sysio/state_history/compression.hpp
>
2
3
#include <boost/iostreams/device/back_inserter.hpp>
4
#include <boost/iostreams/filter/zlib.hpp>
5
#include <boost/iostreams/filtering_stream.hpp>
6
7
namespace
sysio
{
8
namespace
state_history {
9
10
namespace
bio = boost::iostreams;
11
bytes
zlib_compress_bytes
(
const
bytes
& in) {
12
bytes
out;
13
bio::filtering_ostream comp;
14
comp.push(bio::zlib_compressor(bio::zlib::default_compression));
15
comp.push(bio::back_inserter(out));
16
bio::write(comp, in.data(), in.size());
17
bio::close(comp);
18
return
out;
19
}
20
21
bytes
zlib_decompress
(
const
bytes
& in) {
22
bytes
out;
23
bio::filtering_ostream decomp;
24
decomp.push(bio::zlib_decompressor());
25
decomp.push(bio::back_inserter(out));
26
bio::write(decomp, in.data(), in.size());
27
bio::close(decomp);
28
return
out;
29
}
30
31
}
// namespace state_history
32
}
// namespace sysio
fc::vector< char >
compression.hpp
sysio::state_history::zlib_compress_bytes
bytes zlib_compress_bytes(const bytes &in)
Definition
compression.cpp:11
sysio::state_history::zlib_decompress
bytes zlib_decompress(const bytes &in)
Definition
compression.cpp:21
sysio
Definition
abi_serializer.cpp:8
libraries
state_history
compression.cpp
Generated by
1.12.0