#include <zlibbytearray.h>
Public Types | |
None | |
Gzip | |
Zlib | |
enum | CompressionMethod { None, Gzip, Zlib } |
Public Member Functions | |
ZlibByteArray (QByteArray data) | |
QByteArray | compress (const CompressionMethod method=Zlib, QString *errmsg=0) const |
QByteArray | uncompress (CompressionMethod method=Zlib, QString *errmsg=0) const |
Static Public Member Functions | |
static QByteArray | compress (const QByteArray in, const CompressionMethod method=Zlib, QString *errmsg=0) |
static QByteArray | uncompress (const QByteArray in, const CompressionMethod method=Zlib, QString *errmsg=0) |
static bool | isZlibAvailable () |
static bool | isGzipSupported () |
Static Private Member Functions | |
static int | methodBits (CompressionMethod method) |
static QString | methodString (CompressionMethod method) |
Definition at line 60 of file zlibbytearray.h.
Available compression methods.
Definition at line 64 of file zlibbytearray.h.
ZlibByteArray::ZlibByteArray | ( | QByteArray | data | ) |
Constructor.
Definition at line 81 of file zlibbytearray.cpp.
QByteArray ZlibByteArray::compress | ( | const QByteArray | in, | |
const CompressionMethod | method = Zlib , |
|||
QString * | errmsg = 0 | |||
) | [static] |
Compreses the contents of in using method.
Definition at line 164 of file zlibbytearray.cpp.
References z_stream_s::avail_in, z_stream_s::avail_out, deflateInit2, err(), Gzip, isGzipSupported(), methodBits(), methodString(), z_stream_s::msg, z_stream_s::next_in, z_stream_s::next_out, None, z_stream_s::opaque, z_stream_s::total_out, Z_BEST_COMPRESSION, Z_BUF_ERROR, Z_DEFAULT_STRATEGY, Z_DEFLATED, Z_FINISH, Z_NULL, Z_OK, Z_STREAM_END, z_stream_s::zalloc, z_stream_s::zfree, and ZLIB_VERSION.
QByteArray ZlibByteArray::compress | ( | const CompressionMethod | method = Zlib , |
|
QString * | errmsg = 0 | |||
) | const |
Compresses the current contents of this object using method.
Definition at line 154 of file zlibbytearray.cpp.
bool ZlibByteArray::isGzipSupported | ( | ) | [static] |
Returns true iff we support gzip-based compression. Otherwise, we need to use zlib.
Definition at line 132 of file zlibbytearray.cpp.
Referenced by compress(), GeoIpRequest::createHeader(), and uncompress().
bool ZlibByteArray::isZlibAvailable | ( | ) | [static] |
Returns true if the Zlib compression library is available and usable.
Definition at line 108 of file zlibbytearray.cpp.
References ZLIB_VERSION.
Referenced by GeoIpRequest::createHeader().
int ZlibByteArray::methodBits | ( | CompressionMethod | method | ) | [static, private] |
Return the 'bits' value to tell zlib to use method.
Definition at line 88 of file zlibbytearray.cpp.
References Gzip.
Referenced by compress(), and uncompress().
QString ZlibByteArray::methodString | ( | CompressionMethod | method | ) | [static, private] |
Returns a string description of method.
Definition at line 96 of file zlibbytearray.cpp.
References Gzip, None, and Zlib.
Referenced by compress(), and uncompress().
QByteArray ZlibByteArray::uncompress | ( | const QByteArray | in, | |
const CompressionMethod | method = Zlib , |
|||
QString * | errmsg = 0 | |||
) | [static] |
Uncompresses the contents of in using method.
Definition at line 271 of file zlibbytearray.cpp.
References z_stream_s::avail_in, z_stream_s::avail_out, err(), Gzip, inflateInit2, isGzipSupported(), methodBits(), methodString(), z_stream_s::msg, z_stream_s::next_in, z_stream_s::next_out, None, z_stream_s::opaque, Z_BUF_ERROR, Z_FINISH, Z_NULL, Z_OK, Z_STREAM_END, z_stream_s::zalloc, z_stream_s::zfree, and ZLIB_VERSION.
QByteArray ZlibByteArray::uncompress | ( | CompressionMethod | method = Zlib , |
|
QString * | errmsg = 0 | |||
) | const |
Uncompresses the current contents of this object using method.
Definition at line 261 of file zlibbytearray.cpp.
Referenced by GeoIpResponse::GeoIpResponse().