Darwin
1.10(beta)
|
Utility class for compressing data using the zlib library. More...
Public Member Functions | |
unsigned int | originalBytes () const |
number of uncompressed bytes | |
unsigned int | compressedBytes () const |
number of compressed bytes | |
void | compress (const unsigned char *data, unsigned int size) |
compress size bytes of data into buffer | |
void | decompress (unsigned char *data) const |
decompress buffer into data | |
size_t | numBytesOnDisk () const |
number of bytes required to store buffer contents on disk | |
bool | write (ostream &os) const |
write compression buffer to output stream | |
bool | read (istream &is) |
read compression buffer from input stream | |
drwnCompressionBuffer | clone () const |
clone the buffer | |
void | free () |
free all memory associated with the buffer | |
Protected Attributes | |
unsigned char * | _data |
unsigned int | _bytesAllocated |
unsigned int | _bytesOriginal |
unsigned int | _bytesCompressed |
Utility class for compressing data using the zlib library.
The class holds compressed data. Copying the buffer does not copy the data (i.e., a shallow copy is performed). To copy the data use the clone member function. When decompressing data enough space must be allocated in output buffer. The following code snippet shows example usage: