Identifying whether a byte array consists of compressed data
807580Sep 1 2009 — edited Sep 1 2009Hi,
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