improvements to zlib streams (patch 929416):

1. CanHandleGZip static method
2. code cleanup
3. 2.4 compatibility mode


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-04-11 19:34:56 +00:00
parent 3e0a7f68f9
commit 4c68a10264
4 changed files with 172 additions and 70 deletions

View File

@@ -4,7 +4,8 @@
\section{\class{wxZlibInputStream}}\label{wxzlibinputstream}
This filter stream decompresses a stream that is in zlib or gzip format.
Note that reading the gzip format requires zlib version 1.2.0 greater.
Note that reading the gzip format requires zlib version 1.2.1 or greater,
(the builtin version does support gzips).
The stream is not seekable, \helpref{SeekI()}{wxinputstreamseeki} returns
{\it wxInvalidOffset}. Also \helpref{GetSize()}{wxstreambasegetsize} is
@@ -27,25 +28,45 @@ not supported, it always returns $0$.
\membersection{wxZlibInputStream::wxZlibInputStream}
\func{}{wxZlibInputStream}{\param{wxInputStream\&}{ stream}, \param{int}{ flags = wxZLIB\_ZLIB | wxZLIB\_GZIP}}
\func{}{wxZlibInputStream}{\param{wxInputStream\&}{ stream}, \param{int}{ flags = wxZLIB\_AUTO}}
The {\it flags} wxZLIB\_ZLIB and wxZLIB\_GZIP specify whether the input data
is in zlib or gzip format. If both are used, bitwise ored, then zlib will
is in zlib or gzip format. If wxZLIB\_AUTO is used, then zlib will
autodetect the stream type, this is the default.
If {\it flags} is zero, then the data is assumed to be a raw deflate stream
without either zlib or gzip headers.
If {\it flags} is wxZLIB\_NO\_HEADER, then the data is assumed to be a raw
deflate stream without either zlib or gzip headers. This is a lower level
mode, which is not usually used directly. It can be used to read a raw
deflate stream embedded in a higher level protocol.
%if WXWIN_COMPATIBILITY_2_4
This version is not by default compatible with the output produced by
the version of {\it wxZlibOutputStream} in wxWidgets 2.4.x. However,
there is a compatibilty mode, which is switched on by passing
wxZLIB\_24COMPATIBLE for flags. Note that in when operating in compatibilty
mode error checking is very much reduced.
%endif
The following symbols can be use for the flags:
\begin{verbatim}
// Flags
enum {
wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum
wxZLIB_ZLIB = 1, // zlib header and checksum
wxZLIB_GZIP = 2 // gzip header and checksum, requires zlib 1.2+
#if WXWIN_COMPATIBILITY_2_4
wxZLIB_24COMPATIBLE = 4, // read v2.4.x data without error
#endif
wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum
wxZLIB_ZLIB = 1, // zlib header and checksum
wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+
wxZLIB_AUTO = 3 // autodetect header zlib or gzip
};
\end{verbatim}
\membersection{wxZlibInputStream::CanHandleGZip}\label{wxzlibinputstreamcanhandlegzip}
\func{static bool}{CanHandleGZip}{\void}
Returns true if zlib library in use can handle gzip compressed data.
% -----------------------------------------------------------------------------
% wxZlibOutputStream
@@ -54,7 +75,8 @@ enum {
This stream compresses all data written to it. The compressed output can be
in zlib or gzip format.
Note that writing the gzip format requires zlib version 1.2.0 greater.
Note that writing the gzip format requires zlib version 1.2.1 or greater
(the builtin version does support gzips).
The stream is not seekable, \helpref{SeekO()}{wxoutputstreamseeko} returns
{\it wxInvalidOffset}.
@@ -86,8 +108,11 @@ value (currently equivalent to 6).
The {\it flags} wxZLIB\_ZLIB and wxZLIB\_GZIP specify whether the output data
will be in zlib or gzip format. wxZLIB\_ZLIB is the default.
If {\it flags} is zero, then a raw deflate stream is output without either
zlib or gzip headers.
If {\it flags} is wxZLIB\_NO\_HEADER, then a raw deflate stream is output
without either zlib or gzip headers. This is a lower level
mode, which is not usually used directly. It can be used to embed a raw
deflate stream in a higher level protocol.
The following symbols can be use for the compression level and flags:
@@ -104,7 +129,13 @@ enum {
enum {
wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum
wxZLIB_ZLIB = 1, // zlib header and checksum
wxZLIB_GZIP = 2 // gzip header and checksum, requires zlib 1.2+
wxZLIB_GZIP = 2 // gzip header and checksum, requires zlib 1.2.1+
};
\end{verbatim}
\membersection{wxZlibOutputStream::CanHandleGZip}\label{wxoutputstreamcanhandlegzip}
\func{static bool}{CanHandleGZip}{\void}
Returns true if zlib library in use can handle gzip compressed data.