Fork us on GitHub

GZip Support

We now have new support for GZipInputStream and GZipOutputStr...

GZip Support

Zip
We now have new support for GZipInputStream and GZipOutputStream thanks to the great work done by the guys in the JZLib project, we ported their work into the project class hierarchy and added a GZConnectionRequest which will automatically unzip an HTTP response if it is indeed gzipped.

By default this class doesn't request gzipped data but its pretty easy to do so just add the HTTP header Accept-Encoding: gzip e.g.:
GZConnectionRequest con = new GZConnectionRequest();
con. addRequestHeader("Accept-Encoding", "gzip");

Do the rest as usual and you should have smaller responses by potential.

We thought about adding this capability to the global ConnectionRequest but eventually decided not to do so since it will increase the size of the distribution to everyone. If you do not need the gzip functionality the obfuscator will just strip it out during the compile process.

Notice: This post was automatically converted using a script from an older blogging system. Some elements might not have come out as intended.... If that is the case please let us know via the comments section below.

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.