Main index  |  Module description  |  Classes  |  Enums

ClassZLib

class ZLib

ZLib encapsulation interface. more...


Member list

Methods
compress Compress a buffer (classwide method).
compressText Compress a text string (classwide method).
uncompress Uncompress a buffer (classwide method).
uncompressText Uncompress a buffer into a text (classwide method).

Detailed description

Actually, this is a encapsulation class which is used to insolate ZLib functions. Methods in this encapsulation are class-static methods of the ZLib class, and it is not necessary to create an instance of this class to use its methods.


Class methods

compress()

Compress a buffer (classwide method).

ZLib.compress( buffer )
buffer

A string or a MemBuf to be compressed.

Returns:

A compressed buffer (in a byte-wide MemBuf).

Raises:
ZLibError

on compression error.

This method will compress the data considering its raw memory value. This is suitable for bytewise strings loaded from binary streams and byte-wide memory buffers.

Strings containing multi-byte characters can be compressed through this method, but the decompression process must know their original size and perform an adequate trancoding.

For text strings, it is preferrable to use the ZLib.compressText function.

compressText()

Compress a text string (classwide method).

ZLib.compressText( text )
text

A string containing a text be compressed.

Returns:

A compressed buffer (in a byte-wide MemBuf).

Raises:
ZLibError

on compression error.

This method will compress the a text so that an ZLib.uncompressText re-creates the original string.

uncompress()

Uncompress a buffer (classwide method).

ZLib.uncompress( buffer )
buffer

A string or MemBuf containing previusly compressed data.

Returns:

A MemBuf containing the uncompressed data.

Raises:
ZLibError

on decompression error.

uncompressText()

Uncompress a buffer into a text (classwide method).

ZLib.uncompressText( buffer )
buffer

A MemBuf or string containing previusly compressed text data.

Returns:

A uncompressed string.

Raises:
ZLibError

on decompression error.

The input buffer must be a string previously compressed with the ZLib.compressText method, or the function will fail.


Main index  |  Module description  |  Classes  |  Enums
Made with Faldoc 1.0.0