CMS 3D CMS Logo

ZipOutputStream.h

Go to the documentation of this file.
00001 #ifndef CLASSLIB_ZIP_OUTPUT_STREAM_H
00002 # define CLASSLIB_ZIP_OUTPUT_STREAM_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "classlib/zip/ZOutputStream.h"
00007 # include <vector>
00008 # include <string>
00009 
00010 namespace lat {
00011 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00012 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00013 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00014 
00015 class ZipMember;
00016 class MemoryStorage;
00017 
00018 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00019 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00020 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00021 
00022 // Writes a zip archive straight into an output stream.  NB: this
00023 // buffers the member's data until the member is closed so that it can
00024 // write the correct sizes and crc32!  Handle stored and compressed
00025 // files!
00026 class ZipOutputStream : public ZOutputStream
00027 {
00028 public:
00029     ZipOutputStream (OutputStream *output);
00030     ~ZipOutputStream (void);
00031 
00032     using ZOutputStream::write;
00033 
00034     virtual void        nextMember (ZipMember *member);
00035     virtual IOSize      write (const void *from, IOSize n);
00036     virtual void        closeMember (void);
00037     virtual void        finish (void);
00038     virtual void        close (void);
00039 
00040     virtual void        comment (const std::string &text);
00041     virtual void        method (Method m);
00042     virtual void        level (unsigned n);
00043 
00044 private:
00045     std::string         m_comment;      //< ZIP archive comment
00046     Method              m_method;       //< Default compression method
00047     unsigned            m_level;        //< Default compression level
00048     IOOffset            m_total;        //< Total bytes written
00049 
00050     std::vector<ZipMember *> m_members; //< Members already written
00051     ZipMember           *m_current;     //< Current member we are writing
00052     MemoryStorage       *m_buffer;      //< Capture buffer
00053     OutputStream        *m_bufout;      //< Capture buffer or downstream
00054     IOOffset            m_usize;        //< Uncompressed size of current member
00055     bool                m_finished;     //< Flag indicating this level is finished
00056 };
00057 
00058 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00059 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00060 
00061 } // namespace lat
00062 #endif // CLASSLIB_ZIP_OUTPUT_STREAM_H

Generated on Tue Jun 9 17:39:00 2009 for CMSSW by  doxygen 1.5.4