]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/gzstream.tex
Added wxPATH_NORM_SHORTCUT
[wxWidgets.git] / docs / latex / wx / gzstream.tex
... / ...
CommitLineData
1%
2% automatically generated by HelpGen $Revision$ from
3% gzstream.h at 20/Aug/03 18:41:55
4%
5
6%
7% wxGzipInputStream
8%
9
10\section{\class{wxGzipInputStream}}\label{wxgzipinputstream}
11
12A stream filter to decompress gzipped data. The gzip format is specified in
13RFC-1952.
14
15A gzip stream can contain the original filename and timestamp of the
16compressed data. These fields can be obtained using the
17 \helpref{GetName()}{wxgzipinputstreamgetname} and
18 \helpref{GetDateTime()}{wxgzipinputstreamgetdatetime} accessors.
19
20If the stream turns out not to be a gzip stream (i.e. the signature bytes
210x1f, 0x8b are not found), then the constructor unreads the bytes read and
22sets the stream state to {\it wxSTREAM\_EOF}.
23
24So given a possibly gzipped stream '{\it maybe\_gzipped}' you can construct
25a decompressed stream '{\it decompressed}' with something like:
26
27\begin{verbatim}
28wxGzipInputStream gzip(maybe_gzipped);
29wxInputStream *decompressed = &gzip;
30if (gzip.Eof())
31 decompressed = &maybe_gzipped;
32
33\end{verbatim}
34The stream will not read past the end of the gzip data, therefore you
35can read another gzip entry concatenated by creating another
36 {\it wxGzipInputStream} on the same underlying stream.
37
38The stream is not seekable, \helpref{SeekI()}{wxinputstreamseeki} returns
39 {\it wxInvalidOffset}. Also \helpref{GetSize()}{wxstreambasegetsize} is
40not supported, it always returns $0$.
41
42\wxheading{Derived from}
43
44\helpref{wxFilterInputStream}{wxfilterinputstream}
45
46\wxheading{Include files}
47
48<wx/gzstream.h>
49
50\wxheading{See also}
51
52\helpref{wxGzipOutputStream}{wxgzipoutputstream},
53 \helpref{wxZlibInputStream}{wxzlibinputstream},
54 \helpref{wxInputStream}{wxinputstream}.
55
56\latexignore{\rtfignore{\wxheading{Members}}}
57
58
59\membersection{wxGzipInputStream::wxGzipInputStream}\label{wxgzipinputstreamwxgzipinputstream}
60
61\func{}{wxGzipInputStream}{\param{wxInputStream\& }{stream}, \param{wxMBConv\& }{conv = wxConvFile}}
62
63Constructs an object to decompress a gzipped stream.
64
65The constructor reads the gzip header. If the original file name and timestamp
66are present, then they can be obtained through the
67 \helpref{GetName()}{wxgzipinputstreamgetname} and
68 \helpref{GetDateTime()}{wxgzipinputstreamgetdatetime} accessors.
69
70The filename in the header is stored using an 8-bit character set. In a
71Unicode build {\it conv} is used to translate the filename into Unicode (it
72has no effect on the stream data). RFC-1952 specifies that the character set
73should be ISO-8859-1, however the default here is to use {\it wxConvFile}
74 which more closely matches the behaviour of the gzip program. In
75a non-Unicode build {\it conv} is ignored.
76
77If the first two bytes are not the gzip signature, then the data is not
78gzipped after all. The stream state is set to {\it wxSTREAM\_EOF}, and the
79two bytes are unread so that the underlying stream can be read directly.
80
81
82\membersection{wxGzipInputStream::\destruct{wxGzipInputStream}}\label{wxgzipinputstreamdtor}
83
84\func{}{\destruct{wxGzipInputStream}}{\void}
85
86Destructor.
87
88
89\membersection{wxGzipInputStream::GetDateTime}\label{wxgzipinputstreamgetdatetime}
90
91\constfunc{wxDateTime}{GetDateTime}{\void}
92
93Returns the original modification time of gzipped data, as obtained from the
94gzip header.
95
96
97\membersection{wxGzipInputStream::GetName}\label{wxgzipinputstreamgetname}
98
99\constfunc{wxString}{GetName}{\void}
100
101Returns the original filename of gzipped data, with any directory components
102removed.
103
104
105%
106% wxGzipOutputStream
107%
108
109\section{\class{wxGzipOutputStream}}\label{wxgzipoutputstream}
110
111A stream filter to compress gzipped data. The gzip format is specified in
112RFC-1952.
113
114The stream is not seekable, \helpref{SeekO()}{wxoutputstreamseeko} returns
115 {\it wxInvalidOffset}.
116
117
118\wxheading{Derived from}
119
120\helpref{wxFilterOutputStream}{wxfilteroutputstream}
121
122\wxheading{Include files}
123
124<wx/gzstream.h>
125
126\wxheading{See also}
127
128\helpref{wxGzipInputStream}{wxgzipinputstream},
129 \helpref{wxZlibOutputStream}{wxzliboutputstream},
130 \helpref{wxOutputStream}{wxoutputstream}.
131
132\latexignore{\rtfignore{\wxheading{Members}}}
133
134
135\membersection{wxGzipOutputStream::wxGzipOutputStream}\label{wxgzipoutputstreamwxgzipoutputstream}
136
137\func{}{wxGzipOutputStream}{\param{wxOutputStream\& }{stream}, \param{const wxString\& }{originalName = wxEmptyString}, \param{const wxDateTime\& }{originalTime = wxDateTime::Now()}, \param{int }{level = -1}, \param{wxMBConv\& }{conv = wxConvFile}}
138
139If the {\it originalName} is given, then it is written to the gzip header
140with any directory components removed. On a Unicode build it is first
141converted to an 8-bit encoding using {\it conv}. RFC-1952 specifies that
142the character set should be ISO-8859-1, however the default here is to
143use {\it wxConvFile} which more closely matches the behaviour of the gzip
144program. In a non-Unicode build {\it conv} is ignored. {\it conv} has no
145effect on the stream data.
146
147If {\it originalTime} is given then it is also written to the gzip header
148as the timestamp. If omitted the current time is used.
149
150{\it level} is the compression level. It can be an integer between $0$ (no
151compression) and $9$ (most compression). $-1$ specifies that the default
152compression should be used, and is currently equivalent to $6$.
153
154You can also use the following constants from <wx/zstream.h>:
155
156\begin{verbatim}
157// Compression level
158enum {
159 wxZ_DEFAULT_COMPRESSION = -1,
160 wxZ_NO_COMPRESSION = 0,
161 wxZ_BEST_SPEED = 1,
162 wxZ_BEST_COMPRESSION = 9
163}
164\end{verbatim}
165
166
167\membersection{wxGzipOutputStream::\destruct{wxGzipOutputStream}}\label{wxgzipoutputstreamdtor}
168
169\func{}{\destruct{wxGzipOutputStream}}{\void}
170
171Destructor.
172