2.14.1Class ZLib

ZLib encapsulation interface.

Class ZLib

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.

Methods
compressCompress a buffer (classwide method).
compressTextCompress a text string (classwide method).
uncompressUncompress a buffer (classwide method).
uncompressTextUncompress a buffer into a text (classwide method).

Methods

compress

Compress a buffer (classwide method).

ZLib.compress( buffer )
buffer A string or a MemBuf to be compressed.
ReturnA compressed buffer (in a byte-wide MemBuf).
Raise
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.
ReturnA compressed buffer (in a byte-wide MemBuf).
Raise
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.
ReturnA MemBuf containing the uncompressed data.
Raise
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.
ReturnA uncompressed string.
Raise
ZLibError on decompression error.

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

Made with http://www.falconpl.org