]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: zstream.h | |
3 | // Purpose: interface of wxZlibOutputStream | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxZlibOutputStream | |
11 | ||
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). | |
16 | ||
17 | The stream is not seekable, wxOutputStream::SeekO returns | |
18 | @e wxInvalidOffset. | |
19 | ||
20 | @library{wxbase} | |
21 | @category{streams} | |
22 | ||
23 | @see wxOutputStream, wxZlibInputStream | |
24 | */ | |
25 | class wxZlibOutputStream : public wxFilterOutputStream | |
26 | { | |
27 | public: | |
28 | //@{ | |
29 | /** | |
30 | Creates a new write-only compressed stream. @a level means level of | |
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). | |
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. | |
36 | The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the output data | |
37 | will be in zlib or gzip format. wxZLIB_ZLIB is the default. | |
38 | If @a flags is wxZLIB_NO_HEADER, then a raw deflate stream is output | |
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. | |
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); | |
46 | wxZlibOutputStream(wxOutputStream* stream, int level = -1, | |
47 | int flags = wxZLIB_ZLIB); | |
48 | //@} | |
49 | ||
50 | /** | |
51 | Returns @true if zlib library in use can handle gzip compressed data. | |
52 | */ | |
53 | static bool CanHandleGZip(); | |
54 | }; | |
55 | ||
56 | ||
57 | ||
58 | /** | |
59 | @class wxZlibInputStream | |
60 | ||
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). | |
64 | ||
65 | The stream is not seekable, wxInputStream::SeekI returns | |
66 | @e wxInvalidOffset. Also wxStreamBase::GetSize is | |
67 | not supported, it always returns 0. | |
68 | ||
69 | @library{wxbase} | |
70 | @category{streams} | |
71 | ||
72 | @see wxInputStream, wxZlibOutputStream. | |
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. | |
81 | The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the input data | |
82 | is in zlib or gzip format. If wxZLIB_AUTO is used, then zlib will | |
83 | autodetect the stream type, this is the default. | |
84 | If @a flags is wxZLIB_NO_HEADER, then the data is assumed to be a raw | |
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. | |
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); | |
96 | wxZlibInputStream(wxInputStream* stream, | |
97 | int flags = wxZLIB_AUTO); | |
98 | //@} | |
99 | ||
100 | /** | |
101 | Returns @true if zlib library in use can handle gzip compressed data. | |
102 | */ | |
103 | static bool CanHandleGZip(); | |
104 | }; | |
105 |