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 | |
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). |
Compress a buffer (classwide method).
ZLib.compress( buffer )
buffer | A string or a MemBuf to be compressed. | ||
Return | A compressed buffer (in a byte-wide MemBuf). | ||
Raise |
|
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.
Compress a text string (classwide method).
ZLib.compressText( text )
text | A string containing a text be compressed. | ||
Return | A compressed buffer (in a byte-wide MemBuf). | ||
Raise |
|
This method will compress the a text so that an ZLib.uncompressText re-creates the original string.
Uncompress a buffer (classwide method).
ZLib.uncompress( buffer )
buffer | A string or MemBuf containing previusly compressed data. | ||
Return | A MemBuf containing the uncompressed data. | ||
Raise |
|
Uncompress a buffer into a text (classwide method).
ZLib.uncompressText( buffer )
buffer | A MemBuf or string containing previusly compressed text data. | ||
Return | A uncompressed string. | ||
Raise |
|
The input buffer must be a string previously compressed with the ZLib.compressText method, or the function will fail.