CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/CondFormats/Common/interface/FileBlob.h

Go to the documentation of this file.
00001 #ifndef CondFormats_FileBlob_h
00002 #define CondFormats_FileBlob_h
00003 
00004 #include <vector>
00005 #include <string>
00006 #include <iostream>
00007 
00008 class FileBlob{
00009 
00010  public:
00011   FileBlob() {};
00013   FileBlob(const std::string & fname, bool zip);
00015   FileBlob(std::istream & is, bool zip);
00016 
00017   ~FileBlob(){};
00018 
00020   void read(const std::string&);
00022   void write(const std::string&) const;
00023   
00025   void read(std::istream &);
00027   void write(std::ostream &) const;
00028 
00029   bool isCompressed() const {return compressed;};
00030 
00031   int size() const {return isize;};
00033   std::vector<unsigned char>* getUncompressedBlob() const;
00034   void getUncompressedBlob( std::vector<unsigned char>& myblobcopy ) const;
00035                                  
00036  private:
00037   static unsigned int computeFileSize(const std::string &);
00038   static unsigned int computeStreamSize(std::istream &);
00039 
00040   std::vector<unsigned char> blob;
00041   bool compressed;
00042   unsigned int isize;
00043 };
00044 
00045 #endif