]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/zstream.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxZlibOutputStream
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 enum wxZlibCompressionLevels
{
12 wxZ_DEFAULT_COMPRESSION
= -1,
13 wxZ_NO_COMPRESSION
= 0,
15 wxZ_BEST_COMPRESSION
= 9
20 wxZLIB_NO_HEADER
= 0, //!< raw deflate stream, no header or checksum
21 wxZLIB_ZLIB
= 1, //!< zlib header and checksum
22 wxZLIB_GZIP
= 2, //!< gzip header and checksum, requires zlib 1.2.1+
23 wxZLIB_AUTO
= 3 //!< autodetect header zlib or gzip
28 @class wxZlibOutputStream
30 This stream compresses all data written to it.
32 The compressed output can be in zlib or gzip format.
33 Note that writing the gzip format requires zlib version 1.2.1 or greater
34 (the builtin version does support gzip format).
36 The stream is not seekable, wxOutputStream::SeekO() returns
40 @category{archive,streams}
42 @see wxOutputStream, wxZlibInputStream
44 class wxZlibOutputStream
: public wxFilterOutputStream
49 Creates a new write-only compressed stream.
51 @a level means level of compression. It is number between 0 and 9
52 (including these values) where 0 means no compression and 9 best but
53 slowest compression. -1 is default value (currently equivalent to 6).
55 If the parent stream is passed as a pointer then the new filter stream
56 takes ownership of it. If it is passed by reference then it does not.
58 The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the output data
59 will be in zlib or gzip format. wxZLIB_ZLIB is the default.
61 If @a flags is wxZLIB_NO_HEADER, then a raw deflate stream is output
62 without either zlib or gzip headers. This is a lower level mode, which
63 is not usually used directly. It can be used to embed a raw deflate
64 stream in a higher level protocol.
66 The values of the ::wxZlibCompressionLevels and ::wxZLibFlags
67 enumerations can be used.
69 wxZlibOutputStream(wxOutputStream
& stream
, int level
= -1,
70 int flags
= wxZLIB_ZLIB
);
71 wxZlibOutputStream(wxOutputStream
* stream
, int level
= -1,
72 int flags
= wxZLIB_ZLIB
);
76 Returns @true if zlib library in use can handle gzip compressed data.
78 static bool CanHandleGZip();
82 Sets the dictionary to the specified chunk of data. This can improve
83 compression rate but note that the dictionary has to be the same when
84 you deflate the data as when you inflate the data, otherwise you
85 will inflate corrupted data.
87 Returns @true if the dictionary was successfully set.
89 bool SetDictionary(const char *data
, const size_t datalen
);
90 bool SetDictionary(const wxMemoryBuffer
&buf
);
97 @class wxZlibInputStream
99 This filter stream decompresses a stream that is in zlib or gzip format.
100 Note that reading the gzip format requires zlib version 1.2.1 or greater,
101 (the builtin version does support gzip format).
103 The stream is not seekable, wxInputStream::SeekI returns ::wxInvalidOffset.
104 Also wxStreamBase::GetSize() is not supported, it always returns 0.
107 @category{archive,streams}
109 @see wxInputStream, wxZlibOutputStream.
111 class wxZlibInputStream
: public wxFilterInputStream
116 If the parent stream is passed as a pointer then the new filter stream
117 takes ownership of it. If it is passed by reference then it does not.
119 The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the input data
120 is in zlib or gzip format. If wxZLIB_AUTO is used, then zlib will
121 autodetect the stream type, this is the default.
123 If @a flags is wxZLIB_NO_HEADER, then the data is assumed to be a raw
124 deflate stream without either zlib or gzip headers. This is a lower level
125 mode, which is not usually used directly. It can be used to read a raw
126 deflate stream embedded in a higher level protocol.
128 The values of the ::wxZLibFlags enumeration can be used.
130 wxZlibInputStream(wxInputStream
& stream
, int flags
= wxZLIB_AUTO
);
131 wxZlibInputStream(wxInputStream
* stream
, int flags
= wxZLIB_AUTO
);
135 Returns @true if zlib library in use can handle gzip compressed data.
137 static bool CanHandleGZip();
141 Sets the dictionary to the specified chunk of data. This can improve
142 compression rate but note that the dictionary has to be the same when
143 you deflate the data as when you inflate the data, otherwise you
144 will inflate corrupted data.
146 Returns @true if the dictionary was successfully set.
148 bool SetDictionary(const char *data
, const size_t datalen
);
149 bool SetDictionary(const wxMemoryBuffer
&buf
);