Tutorial :Compression and Decompression in java doesnot work fine for different programming language



Question:

If i compress and decompress data using java then it works fine My if friend uses C#.NET to compress data while i am using java SO inthis case I can not decompress the same data.

I am using inflatter and deflater in java.

Thanks Bapi


Solution:1

Use GZIPInputStream and GZIPOutputStream which are compatible with gzip format.

Note: each compression format is different (though similar in approach) and they have to be the same to work.

Inflator and Deflator are a cut down version of the GZIP format and I wouldn't expect it to work with anything another other than Java.


Solution:2

The java.util Deflator and Inflator support are the basic zip compression and decompression format implementations - they do not create a free standing archive file. Rather they create/read the data stream which corresponds to the data portion of one entry in an archive file.

To create an archive file readable by general compression utilities use either the java.util.GZIPXxx or java.util.ZipXxx classes.


Solution:3

Thanks for your support. I changed my compression logic. I used GZIPInputStream both in java and in C#.NET after this only. my problem is solved

Thanks Bapi


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »