concept Zlib in category apache thrift

This is an excerpt from Manning's book Programmer's Guide to Apache Thrift.
Several Apache Thrift languages support the Zlib transport compression layer (see figure 7.6). Zlib is the open source compression library upon which pkzip, gzip, and many other compression tools are based (see zlib.net for more information on Zlib). All three of our demonstration languages, C++, Java, and Python, support Zlib compression.
To demonstrate Zlib interoperability across languages, we’ll modify the Python program created earlier in the chapter to read the compressed file generated by the C++ program above. In the following listing, we read the data.z compressed file, display the UDT data, and then write out a new compressed data.z.bak version.
Notice a few points of interest here. First, the Python program had no problem reading the C++ compressed file, data.z, because the Python zlib and C++ Zlib implementations are based on the same code base and are fully compatible. The version of the compressed RadioObservation object written by the Python program (data.z.bak) is identical to the C++ version (data.z). You can pass the Python TZlibTransport constructor an alternate compression level as the second parameter of the constructor. For example
trans = TZlibTransport.TZlibTransport(ep_trans, 6)Note that the compression level affects only compression output. Any proper Zlib transport can decode data at any level of compression.
The Java TZlibTransport is also implemented as a transport layer, much like the C++ and Python examples here. See the book website for Java versions of the above Zlib examples.