]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/zstream.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxZlibOutputStream
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
10 enum wxZlibCompressionLevels
{
11 wxZ_DEFAULT_COMPRESSION
= -1,
12 wxZ_NO_COMPRESSION
= 0,
14 wxZ_BEST_COMPRESSION
= 9
19 wxZLIB_NO_HEADER
= 0, //!< raw deflate stream, no header or checksum
20 wxZLIB_ZLIB
= 1, //!< zlib header and checksum
21 wxZLIB_GZIP
= 2, //!< gzip header and checksum, requires zlib 1.2.1+
22 wxZLIB_AUTO
= 3 //!< autodetect header zlib or gzip
27 @class wxZlibOutputStream
29 This stream compresses all data written to it.
31 The compressed output can be in zlib or gzip format.
32 Note that writing the gzip format requires zlib version 1.2.1 or greater
33 (the builtin version does support gzip format).
35 The stream is not seekable, wxOutputStream::SeekO() returns
39 @category{archive,streams}
41 @see wxOutputStream, wxZlibInputStream
43 class wxZlibOutputStream
: public wxFilterOutputStream
48 Creates a new write-only compressed stream.
50 @a level means level of compression. It is number between 0 and 9
51 (including these values) where 0 means no compression and 9 best but
52 slowest compression. -1 is default value (currently equivalent to 6).
54 If the parent stream is passed as a pointer then the new filter stream
55 takes ownership of it. If it is passed by reference then it does not.
57 The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the output data
58 will be in zlib or gzip format. wxZLIB_ZLIB is the default.
60 If @a flags is wxZLIB_NO_HEADER, then a raw deflate stream is output
61 without either zlib or gzip headers. This is a lower level mode, which
62 is not usually used directly. It can be used to embed a raw deflate
63 stream in a higher level protocol.
65 The values of the ::wxZlibCompressionLevels and ::wxZLibFlags
66 enumerations can be used.
68 wxZlibOutputStream(wxOutputStream
& stream
, int level
= -1,
69 int flags
= wxZLIB_ZLIB
);
70 wxZlibOutputStream(wxOutputStream
* stream
, int level
= -1,
71 int flags
= wxZLIB_ZLIB
);
75 Returns @true if zlib library in use can handle gzip compressed data.
77 static bool CanHandleGZip();
81 Sets the dictionary to the specified chunk of data. This can improve
82 compression rate but note that the dictionary has to be the same when
83 you deflate the data as when you inflate the data, otherwise you
84 will inflate corrupted data.
86 Returns @true if the dictionary was successfully set.
88 bool SetDictionary(const char *data
, const size_t datalen
);
89 bool SetDictionary(const wxMemoryBuffer
&buf
);
96 @class wxZlibInputStream
98 This filter stream decompresses a stream that is in zlib or gzip format.
99 Note that reading the gzip format requires zlib version 1.2.1 or greater,
100 (the builtin version does support gzip format).
102 The stream is not seekable, wxInputStream::SeekI returns ::wxInvalidOffset.
103 Also wxStreamBase::GetSize() is not supported, it always returns 0.
106 @category{archive,streams}
108 @see wxInputStream, wxZlibOutputStream.
110 class wxZlibInputStream
: public wxFilterInputStream
115 If the parent stream is passed as a pointer then the new filter stream
116 takes ownership of it. If it is passed by reference then it does not.
118 The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the input data
119 is in zlib or gzip format. If wxZLIB_AUTO is used, then zlib will
120 autodetect the stream type, this is the default.
122 If @a flags is wxZLIB_NO_HEADER, then the data is assumed to be a raw
123 deflate stream without either zlib or gzip headers. This is a lower level
124 mode, which is not usually used directly. It can be used to read a raw
125 deflate stream embedded in a higher level protocol.
127 The values of the ::wxZLibFlags enumeration can be used.
129 wxZlibInputStream(wxInputStream
& stream
, int flags
= wxZLIB_AUTO
);
130 wxZlibInputStream(wxInputStream
* stream
, int flags
= wxZLIB_AUTO
);
134 Returns @true if zlib library in use can handle gzip compressed data.
136 static bool CanHandleGZip();
140 Sets the dictionary to the specified chunk of data. This can improve
141 compression rate but note that the dictionary has to be the same when
142 you deflate the data as when you inflate the data, otherwise you
143 will inflate corrupted data.
145 Returns @true if the dictionary was successfully set.
147 bool SetDictionary(const char *data
, const size_t datalen
);
148 bool SetDictionary(const wxMemoryBuffer
&buf
);