]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: zstream.h | |
e54c96f1 | 3 | // Purpose: interface of wxZlibOutputStream |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxZlibOutputStream | |
7c913512 | 11 | |
23324ae1 FM |
12 | This stream compresses all data written to it. The compressed output can be |
13 | in zlib or gzip format. | |
14 | Note that writing the gzip format requires zlib version 1.2.1 or greater | |
15 | (the builtin version does support gzip format). | |
7c913512 | 16 | |
23324ae1 FM |
17 | The stream is not seekable, wxOutputStream::SeekO returns |
18 | @e wxInvalidOffset. | |
7c913512 | 19 | |
23324ae1 FM |
20 | @library{wxbase} |
21 | @category{streams} | |
7c913512 | 22 | |
e54c96f1 | 23 | @see wxOutputStream, wxZlibInputStream |
23324ae1 FM |
24 | */ |
25 | class wxZlibOutputStream : public wxFilterOutputStream | |
26 | { | |
27 | public: | |
28 | //@{ | |
29 | /** | |
4cc4bfaf | 30 | Creates a new write-only compressed stream. @a level means level of |
23324ae1 FM |
31 | compression. It is number between 0 and 9 (including these values) where |
32 | 0 means no compression and 9 best but slowest compression. -1 is default | |
33 | value (currently equivalent to 6). | |
23324ae1 FM |
34 | If the parent stream is passed as a pointer then the new filter stream |
35 | takes ownership of it. If it is passed by reference then it does not. | |
4cc4bfaf | 36 | The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the output data |
23324ae1 | 37 | will be in zlib or gzip format. wxZLIB_ZLIB is the default. |
4cc4bfaf | 38 | If @a flags is wxZLIB_NO_HEADER, then a raw deflate stream is output |
23324ae1 FM |
39 | without either zlib or gzip headers. This is a lower level |
40 | mode, which is not usually used directly. It can be used to embed a raw | |
41 | deflate stream in a higher level protocol. | |
23324ae1 FM |
42 | The following symbols can be use for the compression level and flags: |
43 | */ | |
44 | wxZlibOutputStream(wxOutputStream& stream, int level = -1, | |
45 | int flags = wxZLIB_ZLIB); | |
7c913512 FM |
46 | wxZlibOutputStream(wxOutputStream* stream, int level = -1, |
47 | int flags = wxZLIB_ZLIB); | |
23324ae1 FM |
48 | //@} |
49 | ||
50 | /** | |
51 | Returns @true if zlib library in use can handle gzip compressed data. | |
52 | */ | |
53 | static bool CanHandleGZip(); | |
54 | }; | |
55 | ||
56 | ||
e54c96f1 | 57 | |
23324ae1 FM |
58 | /** |
59 | @class wxZlibInputStream | |
7c913512 | 60 | |
23324ae1 FM |
61 | This filter stream decompresses a stream that is in zlib or gzip format. |
62 | Note that reading the gzip format requires zlib version 1.2.1 or greater, | |
63 | (the builtin version does support gzip format). | |
7c913512 | 64 | |
23324ae1 FM |
65 | The stream is not seekable, wxInputStream::SeekI returns |
66 | @e wxInvalidOffset. Also wxStreamBase::GetSize is | |
67 | not supported, it always returns 0. | |
7c913512 | 68 | |
23324ae1 FM |
69 | @library{wxbase} |
70 | @category{streams} | |
7c913512 | 71 | |
e54c96f1 | 72 | @see wxInputStream, wxZlibOutputStream. |
23324ae1 FM |
73 | */ |
74 | class wxZlibInputStream : public wxFilterInputStream | |
75 | { | |
76 | public: | |
77 | //@{ | |
78 | /** | |
79 | If the parent stream is passed as a pointer then the new filter stream | |
80 | takes ownership of it. If it is passed by reference then it does not. | |
4cc4bfaf | 81 | The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the input data |
23324ae1 FM |
82 | is in zlib or gzip format. If wxZLIB_AUTO is used, then zlib will |
83 | autodetect the stream type, this is the default. | |
4cc4bfaf | 84 | If @a flags is wxZLIB_NO_HEADER, then the data is assumed to be a raw |
23324ae1 FM |
85 | deflate stream without either zlib or gzip headers. This is a lower level |
86 | mode, which is not usually used directly. It can be used to read a raw | |
87 | deflate stream embedded in a higher level protocol. | |
23324ae1 FM |
88 | This version is not by default compatible with the output produced by |
89 | the version of @e wxZlibOutputStream in wxWidgets 2.4.x. However, | |
90 | there is a compatibility mode, which is switched on by passing | |
91 | wxZLIB_24COMPATIBLE for flags. Note that in when operating in compatibility | |
92 | mode error checking is very much reduced. | |
93 | The following symbols can be use for the flags: | |
94 | */ | |
95 | wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO); | |
7c913512 FM |
96 | wxZlibInputStream(wxInputStream* stream, |
97 | int flags = wxZLIB_AUTO); | |
23324ae1 FM |
98 | //@} |
99 | ||
100 | /** | |
101 | Returns @true if zlib library in use can handle gzip compressed data. | |
102 | */ | |
103 | static bool CanHandleGZip(); | |
104 | }; | |
e54c96f1 | 105 |