1 #ifndef ZIPOUTPUTSTREAM_H
2 #define ZIPOUTPUTSTREAM_H
4 #include "zipios++/zipios-config.h"
6 #include "zipios++/meta-iostreams.h"
10 #include "zipios++/ziphead.h"
11 #include "zipios++/zipoutputstreambuf.h"
15 /** \anchor ZipOutputStream_anchor
16 ZipOutputStream is an ostream that writes the output to a zip file. The
17 interface approximates the interface of the Java ZipOutputStream. */
18 class ZipOutputStream : public std::ostream {
21 /** ZipOutputStream constructor.
22 @param os ostream to which the compressed zip archive is written.
23 @param pos position to reposition the ostream to before reading. */
24 explicit ZipOutputStream( std::ostream &os ) ;
26 /** ZipOutputStream constructor.
27 @filename filename to write the zip archive to. */
28 explicit ZipOutputStream( const std::string &filename ) ;
30 /** Closes the current entry updates its header with the relevant
31 size information and positions the stream write pointer for the
32 next entry header. Puts the stream in EOF state. Call
33 putNextEntry() to clear the EOF stream state flag. */
36 /** Calls finish and if the ZipOutputStream was created with a
37 filename as a parameter that file is closed as well. If the
38 ZipOutputStream was created with an ostream as its first
39 parameter nothing but the call to finish happens. */
42 /** Closes the current entry (if one is open), then writes the Zip
43 Central Directory Structure closing the ZipOutputStream. The
44 output stream that the zip archive is being written to is not
48 /** \anchor ZipOutputStream_putnextentry_anchor
49 Begins writing the next entry.
51 void putNextEntry( const ZipCDirEntry &entry ) ;
53 /** \anchor ZipOutputStream_putnextentry2_anchor
54 Begins writing the next entry.
56 void putNextEntry(const std::string& entryName);
58 /** Sets the global comment for the Zip archive. */
59 void setComment( const std::string& comment ) ;
61 /** Sets the compression level to be used for subsequent entries. */
62 void setLevel( int level ) ;
64 /** Sets the compression method to be used. only STORED and DEFLATED are
66 void setMethod( StorageMethod method ) ;
69 virtual ~ZipOutputStream() ;
73 ZipOutputStreambuf *ozf ;
81 Header file that defines ZipOutputStream.
85 Zipios++ - a small C++ library that provides easy access to .zip files.
86 Copyright (C) 2000 Thomas Søndergaard
88 This library is free software; you can redistribute it and/or
89 modify it under the terms of the GNU Lesser General Public
90 License as published by the Free Software Foundation; either
91 version 2 of the License, or (at your option) any later version.
93 This library is distributed in the hope that it will be useful,
94 but WITHOUT ANY WARRANTY; without even the implied warranty of
95 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
96 Lesser General Public License for more details.
98 You should have received a copy of the GNU Lesser General Public
99 License along with this library; if not, write to the Free Software
100 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA