0

I want to compress data in android devices and send it to an ASP.net server-side, but I don't want to consume much power and sacrifice device resources. I've tried compressing data using Deflate stream on android-side and decompressing using the same stream on the server side, but the decompressed string was not the same as the original one. I tried then using GZIP stream and the recovered data was the same as the original one. As I read, Deflate stream is faster than GZIP. So what should I do? Is it the best practice to use GZip stream for data compression and decompression between Android and C#? Is there a way to recover data that is compressed using Deflate stream?

A.J
  • 333
  • 1
  • 2
  • 15

1 Answers1

1

Try using DotNetZip (NuGet) instead of System.IO.Compression.GZipStream.

Wanton
  • 800
  • 6
  • 9
  • Is DeflateStream of DotNetZipt the same as DeflateStream of Java? What is about ZlibStream? Is it the same as DeflateStream of Java? So is it better to use DefalteStream rather than using GZIPStream? – A.J Dec 09 '18 at 04:58
  • Edited my answer. You can use what ever you want from it. What I've read, that it's more compatible with Android's Java compressions than `System.IO.Compression` ones. More info about the library here https://github.com/haf/DotNetZip.Semverd – Wanton Dec 09 '18 at 08:01
  • Also I had trouble answering your question because your question didn't include code you used to compress and code you use to decompress. So it's very hard to help you with what's compatible and what's not. In future when you ask a question, you should provide all information needed to answer your question. `ZlibStream.UncompressBuffer()` might be what you want. – Wanton Dec 09 '18 at 08:15