deflatestream

MSDN C# DeflateStream sample code issue

Hello everyone, Any ideas why in the below sample, we need to add 100 (buffer.Length + 100)? buffer.Length should be the same as decompressed buffer length, so no need to add 100 more. :-) http://msdn.microsoft.com/en-us/library/bc2dbwea.aspx thanks in advance, George ...

Can I use less memory when using DeflateStream?

My application needs to decompress files which contain a lot of Deflate compressed blocks (as well as other types of compression and encryption). Memory profiling shows that the deflate stream constructor is responsible for allocating the majority of the application's memory over its lifetime (54.19%, followed by DeflateStream.read at 12...

Puzzling .Net C# DeflateStream problem

Hi there, I wonder if anyone can shed some light on an issue that is driving me nuts: I am writing a compression decompression test class. To test it, I am serializing a dataset to a memory stream, compressing it, and uncompressing it and comparing the results. Compression is fine, but uncompression is where it hits the dirt. This ...

zip and unzip string with Deflate

Hi I need to zip and unzip string Here is code: public static byte[] ZipStr(String str) { using (MemoryStream output = new MemoryStream()) using (DeflateStream gzip = new DeflateStream(output, CompressionMode.Compress)) using (StreamWriter writer = new StreamWriter(gzip)) { writer.Write(str); ...

Do an HTTP Post in .NET (Vb) with compressed data using deflatestream

The data that I am posting from a VB.Net client is large and I want to compress. I want to do a "POST" and the apache server supports mod_deflate. I am trying to integrate DeflateStream into my post code, however does not seem to be working. I can send the data without compression using the standard code. request.ContentType = "a...

Mono & DeflateStream

I have a simple code byte[] buffer = Encoding.UTF8.GetBytes("abracadabra"); MemoryStream ms = new MemoryStream(); DeflateStream ds = new DeflateStream(ms, CompressionMode.Compress, false); ms.Write(buffer, 0, buffer.Length); DeflateStream ds2 = new DeflateStream(ms, CompressionMode.Decompress, false); byte[] buffer2 = new byte[ms.Leng...

how to both Compress and Minify content together?

hi, i know we can compress response by declaring Response.Filter as GZip or Delfalte streams, but how i can perform both compression and minification together? declaring new class that inherits Stream, then first performing minify on content, then compress that by GZip or Deflate depending on User-Agent supported each? ...

.NET Deflate Stream Error/Bug

Has anyone experienced the following error while using the .NET Deflate Stream? System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.IO.Compression.HuffmanTree.CreateTable() at System.IO.Compression.Inflater.DecodeDynamicBlockHeader() at System.IO.Compression.Inflater.Decode() at System.IO.Compres...

GZipStream and DeflateStream produce bigger files

Hello, I'm trying to use deflate/gzip streams in C# but it appears that the files after compression are bigger than before. For example, I compress a docx file of 900ko, but it produce a 1.4Mo one ! And it does it for every file I tried. May be I am wrong in the way I'm doing it? Here is my code : FileStream input = File.OpenRead(...