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