32 std::vector<unsigned char>
in;
36 in.push_back((
unsigned char)c);
44 uLongf destLen = compressBound(in.size());
45 int zerr = compress2(&*
blob.begin(), &destLen, &*in.begin(), in.size(), 9);
53 blob.push_back((
unsigned char)c);
61 std::vector<unsigned char>
out(
isize);
62 uLongf destLen = out.size();
63 int zerr = uncompress(&*out.begin(), &destLen, &*
blob.begin(),
blob.size());
64 if (zerr != 0 || out.size() != destLen)
65 edm::LogError(
"FileBlob") <<
"uncompressing error " << zerr <<
" original size was " <<
isize <<
" new size is " 67 os.write(reinterpret_cast<const char*>(&*out.begin()), out.size());
69 os.write(reinterpret_cast<const char*>(&*
blob.begin()),
blob.size());
74 std::unique_ptr<std::vector<unsigned char> > newblob;
76 newblob.reset(
new std::vector<unsigned char>(
isize));
77 uLongf destLen = newblob->size();
79 int zerr = uncompress(&*(newblob->begin()), &destLen, &*
blob.begin(),
blob.size());
80 if (zerr != 0 || newblob->size() != destLen)
81 edm::LogError(
"FileBlob") <<
"uncompressing error " << zerr <<
" original size was " <<
isize <<
" new size is " 84 newblob.reset(
new std::vector<unsigned char>(
blob));
91 myblobcopy.reserve(
isize);
92 uLongf destLen =
isize;
93 int zerr = uncompress(&*myblobcopy.begin(), &destLen, &*
blob.begin(),
blob.size());
94 if (zerr != 0 || myblobcopy.size() != destLen)
95 edm::LogError(
"FileBlob") <<
"uncompressing error " << zerr <<
" original size was " <<
isize <<
" new size is " 103 std::ifstream
ifile(fname.c_str());
105 edm::LogError(
"FileBlob") <<
"file " << fname <<
" does not exist...";
112 std::ofstream
ofile(fname.c_str());
119 std::ifstream
ifile(fname.c_str());
121 edm::LogError(
"FileBlob") <<
"file " << fname <<
" does not exist...";
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 write(const std::string &) const
write to real file
void read(const std::string &)
read from real file
std::unique_ptr< std::vector< unsigned char > > getUncompressedBlob() const
i didn't want to do two copies ... hope this works.