Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Identifying whether a byte array consists of compressed data

807580Sep 1 2009 — edited Sep 1 2009
Hi,

I'm new to java.util.zip.

I'm trying to inflate data from a byte array which is originally retrieved from a database. However, I need to dynamically check whether the data in the byte[] was compressed (using java.util.zip.Deflater) or simply uncompressed byte[] representation of String.

Essentially I want to have something like "isInflatable()" so that I can check it before attempting inflation using java.util.zip.Inflater.

Is there a way to do this without actually attempting inflation which may or may not succeed depending on the data in the byte array?

Thanks,
Rahul
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2009
Added on Sep 1 2009
3 comments
662 views