C#自带DeflateStream,生成后的文件和javat生成的不一样,搜索了一下,找到国外一篇文章:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/65537603-d7db-4e66-b5e6-d08275a4e4c8/
也是同样的问题,其中的一个回复是:
The problem is that DeflateStream in c# does not use the same compression algorithm than Deflater in java(and probably objective C).
Instead, try to use the zlib.net library: http://www.componentace.com/zlib_.NET.htm
=====================================
下载引用zlib.net,调用CompressFile()方法,问题解决。
public static void CopyStream(System.IO.Stream input, System.IO.Stream output)
{
byte[] buffer = new