Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Developer
Posts: 9
Registered: ‎04-14-2009
My Device: Not Specified

file compression compatibility with zlib (windows platform)

 I'm trying to port file compression code from the Windows Mobile platform using zlib, to the BlackBerry.  I have a decompression utility on a third platform that has to be able to handle files from both sources.  zlib doesn't have several of the flags that the BlackBerry compression stuff has - there I just call


gzopen(name, "wb9")


Taking the same file and compressing it on the BlackBerry, specifying COMPRESSION_BEST (9), all the resulting files are significantly larger than they should be.  I've tried every combination I can think of, including the ones I expect must be wrong.


new GZIPOutputStream(os, GZIPOutputStream.COMPRESSION_BEST)

new ZLibOutputStream(os, true, ZLibOutputStream.MAX_LOG2_WINDOW_LENGTH, 9)

new ZLibOutputStream(os, false, ZLibOutputStream.MAX_LOG2_WINDOW_LENGTH, 9)


Will varying the window length change the resulting file?  If so, any idea what window length will match zlib's?

Has anyone managed to exchange files between zlib and BlackBerry's compression classes?


* Simulating the Bold

* BlackBerry JDE Component Package 4.5.0