34 std::vector<unsigned char>
in;
38 in.push_back((
unsigned char)
c);
46 uLongf destLen = compressBound(
in.size());
47 int zerr = compress2(&*
blob.begin(), &destLen, &*
in.begin(),
in.size(), 9);
55 blob.push_back((
unsigned char)
c);
63 std::vector<unsigned char>
out(
isize);
64 uLongf destLen =
out.size();
65 int zerr = uncompress(&*
out.begin(), &destLen, &*
blob.begin(),
blob.size());
66 if (
zerr != 0 ||
out.size() != destLen)
67 edm::LogError(
"FileBlob") <<
"uncompressing error " <<
zerr <<
" original size was " <<
isize <<
" new size is " 69 os.write(reinterpret_cast<const char*>(&*
out.begin()),
out.size());
71 os.write(reinterpret_cast<const char*>(&*
blob.begin()),
blob.size());
76 std::unique_ptr<std::vector<unsigned char>> newblob;
78 newblob = std::make_unique<std::vector<unsigned char>>(
isize);
79 uLongf destLen = newblob->size();
81 int zerr = uncompress(&*(newblob->begin()), &destLen, &*
blob.begin(),
blob.size());
82 if (
zerr != 0 || newblob->size() != destLen)
83 edm::LogError(
"FileBlob") <<
"uncompressing error " <<
zerr <<
" original size was " <<
isize <<
" new size is " 86 newblob = std::make_unique<std::vector<unsigned char>>(
blob);
93 myblobcopy.reserve(
isize);
94 uLongf destLen =
isize;
95 int zerr = uncompress(&*myblobcopy.begin(), &destLen, &*
blob.begin(),
blob.size());
96 if (
zerr != 0 || myblobcopy.size() != destLen)
97 edm::LogError(
"FileBlob") <<
"uncompressing error " <<
zerr <<
" original size was " <<
isize <<
" new size is " 114 std::ofstream ofile(
fname.c_str());
Log< level::Error, false > LogError
std::vector< unsigned char > blob
static unsigned int computeFileSize(const std::string &)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
static unsigned int computeStreamSize(std::istream &)
void read(const std::string &)
read from real file
void write(const std::string &) const
write to real file
std::unique_ptr< std::vector< unsigned char > > getUncompressedBlob() const
i didn't want to do two copies ... hope this works.