Vidalia 0.2.12
Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions

ZlibByteArray Class Reference

#include <ZlibByteArray.h>

List of all members.

Public Types

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)

Detailed Description

Definition at line 59 of file ZlibByteArray.h.


Member Enumeration Documentation

Available compression methods.

Enumerator:
None 

No compression method.

Gzip 

Gzip compression method.

Zlib 

Zlib compression method.

Definition at line 63 of file ZlibByteArray.h.


Constructor & Destructor Documentation

ZlibByteArray::ZlibByteArray ( QByteArray  data)

Constructor.

Constructor

Definition at line 81 of file ZlibByteArray.cpp.


Member Function Documentation

QByteArray ZlibByteArray::compress ( const CompressionMethod  method = Zlib,
QString *  errmsg = 0 
) const

Compresses the current contents of this object using method.

Compresses the current contents of this object using method. Returns the compressed data if successful. If an error occurs, this will return an empty QByteArray and set the optional errmsg to a string describing the failure.

Definition at line 154 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.

Compresses in using method. Returns the compressed data if successful. If an error occurs, this will return an empty QByteArray and set the optional errmsg to a string describing the failure.

Definition at line 164 of file ZlibByteArray.cpp.

References err(), Gzip, isGzipSupported(), methodBits(), methodString(), and None.

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(), 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.

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.

Uncompresses in using method. Returns the uncompressed data if successful. If an error occurs, this will return an empty QByteArray and set the optional errmsg to a string describing the failure.

Definition at line 271 of file ZlibByteArray.cpp.

References err(), Gzip, isGzipSupported(), methodBits(), methodString(), and None.

QByteArray ZlibByteArray::uncompress ( CompressionMethod  method = Zlib,
QString *  errmsg = 0 
) const

Uncompresses the current contents of this object using method.

Uncompresses the current contents of this object using method. Returns the uncompressed data if successful. If an error occurs, this will return an empty QByteArray and set the optional errmsg to a string describing the failure.

Definition at line 261 of file ZlibByteArray.cpp.


The documentation for this class was generated from the following files: