]>
Commit | Line | Data |
---|---|---|
1 | % ----------------------------------------------------------------------------- | |
2 | % wxZlibInputStream | |
3 | % ----------------------------------------------------------------------------- | |
4 | \section{\class{wxZlibInputStream}}\label{wxzlibinputstream} | |
5 | ||
6 | This filter stream decompresses a stream that is in zlib or gzip format. | |
7 | Note that reading the gzip format requires zlib version 1.2.1 or greater, | |
8 | (the builtin version does support gzip format). | |
9 | ||
10 | The stream is not seekable, \helpref{SeekI()}{wxinputstreamseeki} returns | |
11 | {\it wxInvalidOffset}. Also \helpref{GetSize()}{wxstreambasegetsize} is | |
12 | not supported, it always returns $0$. | |
13 | ||
14 | \wxheading{Derived from} | |
15 | ||
16 | \helpref{wxFilterInputStream}{wxfilterinputstream} | |
17 | ||
18 | \wxheading{Include files} | |
19 | ||
20 | <wx/zstream.h> | |
21 | ||
22 | \wxheading{See also} | |
23 | ||
24 | \helpref{wxInputStream}{wxinputstream}, | |
25 | \helpref{wxZlibOutputStream}{wxzliboutputstream}. | |
26 | ||
27 | \latexignore{\rtfignore{\wxheading{Members}}} | |
28 | ||
29 | \membersection{wxZlibInputStream::wxZlibInputStream}\label{wxzlibinputstreamwxzlibinputstream} | |
30 | ||
31 | \func{}{wxZlibInputStream}{\param{wxInputStream\&}{ stream}, \param{int}{ flags = wxZLIB\_AUTO}} | |
32 | ||
33 | The {\it flags} wxZLIB\_ZLIB and wxZLIB\_GZIP specify whether the input data | |
34 | is in zlib or gzip format. If wxZLIB\_AUTO is used, then zlib will | |
35 | autodetect the stream type, this is the default. | |
36 | ||
37 | If {\it flags} is wxZLIB\_NO\_HEADER, then the data is assumed to be a raw | |
38 | deflate stream without either zlib or gzip headers. This is a lower level | |
39 | mode, which is not usually used directly. It can be used to read a raw | |
40 | deflate stream embedded in a higher level protocol. | |
41 | ||
42 | %if WXWIN_COMPATIBILITY_2_4 | |
43 | This version is not by default compatible with the output produced by | |
44 | the version of {\it wxZlibOutputStream} in wxWidgets 2.4.x. However, | |
45 | there is a compatibility mode, which is switched on by passing | |
46 | wxZLIB\_24COMPATIBLE for flags. Note that in when operating in compatibility | |
47 | mode error checking is very much reduced. | |
48 | %endif | |
49 | ||
50 | The following symbols can be use for the flags: | |
51 | ||
52 | \begin{verbatim} | |
53 | // Flags | |
54 | enum { | |
55 | #if WXWIN_COMPATIBILITY_2_4 | |
56 | wxZLIB_24COMPATIBLE = 4, // read v2.4.x data without error | |
57 | #endif | |
58 | wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum | |
59 | wxZLIB_ZLIB = 1, // zlib header and checksum | |
60 | wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+ | |
61 | wxZLIB_AUTO = 3 // autodetect header zlib or gzip | |
62 | }; | |
63 | \end{verbatim} | |
64 | ||
65 | \membersection{wxZlibInputStream::CanHandleGZip}\label{wxzlibinputstreamcanhandlegzip} | |
66 | ||
67 | \func{static bool}{CanHandleGZip}{\void} | |
68 | ||
69 | Returns true if zlib library in use can handle gzip compressed data. | |
70 | ||
71 | % ----------------------------------------------------------------------------- | |
72 | % wxZlibOutputStream | |
73 | % ----------------------------------------------------------------------------- | |
74 | \section{\class{wxZlibOutputStream}}\label{wxzliboutputstream} | |
75 | ||
76 | This stream compresses all data written to it. The compressed output can be | |
77 | in zlib or gzip format. | |
78 | Note that writing the gzip format requires zlib version 1.2.1 or greater | |
79 | (the builtin version does support gzip format). | |
80 | ||
81 | The stream is not seekable, \helpref{SeekO()}{wxoutputstreamseeko} returns | |
82 | {\it wxInvalidOffset}. | |
83 | ||
84 | \wxheading{Derived from} | |
85 | ||
86 | \helpref{wxFilterOutputStream}{wxfilteroutputstream} | |
87 | ||
88 | \wxheading{Include files} | |
89 | ||
90 | <wx/zstream.h> | |
91 | ||
92 | \wxheading{See also} | |
93 | ||
94 | \helpref{wxOutputStream}{wxoutputstream}, | |
95 | \helpref{wxZlibInputStream}{wxzlibinputstream} | |
96 | ||
97 | ||
98 | \latexignore{\rtfignore{\wxheading{Members}}} | |
99 | ||
100 | \membersection{wxZlibOutputStream::wxZlibOutputStream}\label{wxzliboutputstreamwxzliboutputstream} | |
101 | ||
102 | \func{}{wxZlibOutputStream}{\param{wxOutputStream\&}{ stream}, \param{int}{ level = -1}, \param{int}{ flags = wxZLIB\_ZLIB}} | |
103 | ||
104 | Creates a new write-only compressed stream. {\it level} means level of | |
105 | compression. It is number between 0 and 9 (including these values) where | |
106 | 0 means no compression and 9 best but slowest compression. -1 is default | |
107 | value (currently equivalent to 6). | |
108 | ||
109 | The {\it flags} wxZLIB\_ZLIB and wxZLIB\_GZIP specify whether the output data | |
110 | will be in zlib or gzip format. wxZLIB\_ZLIB is the default. | |
111 | ||
112 | If {\it flags} is wxZLIB\_NO\_HEADER, then a raw deflate stream is output | |
113 | without either zlib or gzip headers. This is a lower level | |
114 | mode, which is not usually used directly. It can be used to embed a raw | |
115 | deflate stream in a higher level protocol. | |
116 | ||
117 | The following symbols can be use for the compression level and flags: | |
118 | ||
119 | \begin{verbatim} | |
120 | // Compression level | |
121 | enum { | |
122 | wxZ_DEFAULT_COMPRESSION = -1, | |
123 | wxZ_NO_COMPRESSION = 0, | |
124 | wxZ_BEST_SPEED = 1, | |
125 | wxZ_BEST_COMPRESSION = 9 | |
126 | }; | |
127 | ||
128 | // Flags | |
129 | enum { | |
130 | wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum | |
131 | wxZLIB_ZLIB = 1, // zlib header and checksum | |
132 | wxZLIB_GZIP = 2 // gzip header and checksum, requires zlib 1.2.1+ | |
133 | }; | |
134 | \end{verbatim} | |
135 | ||
136 | \membersection{wxZlibOutputStream::CanHandleGZip}\label{wxoutputstreamcanhandlegzip} | |
137 | ||
138 | \func{static bool}{CanHandleGZip}{\void} | |
139 | ||
140 | Returns true if zlib library in use can handle gzip compressed data. | |
141 |