gzipstream

How to get type and number of .zip contents

How can i get the content names of a zipped folder in C# i.e. name of files and folders inside the compressed folder? I want to decompress the zip by using GZipStream only. thanks, kapil ...

Loading specific section of a compressed file stream.

Hi, We have a simple binary file format for caching data in our application (C# .NET Windows App). The format is basically a short that indicates the object type followed by a guid (string) for the object id then any object specific data (strings ints whatever). We want to be able to store many objects in the same file (> 10000) but i...

GZipStream not reading the whole file

I have some code that downloads gzipped files, and decompresses them. The problem is, I can't get it to decompress the whole file, it only reads the first 4096 bytes and then about 500 more. Byte[] buffer = new Byte[4096]; int count = 0; FileStream fileInput = new FileStream("input.gzip", FileMode.Open, FileAccess.Read, FileShare.Read);...

Why is my programmatic compression dropping the file extension?

I am using C# to programatically compress an xml file. Compression works fine, but when I gunzip the file from the command line, the extension has been dropped. Why would this be? The destination file coming in has the gz extension while the source file has an xml extension. Here is my compression code: using (FileStream...

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? ...

Gzip compression for HTTP requests

Is there any way to make browsers &/or Silverlight application do a GZIP compression of HTTP requests? Don't confuse with GZIP compression of HTTP responses - I know how to set this up on the server side. What I need is to compress requests as well, and protocol allows that - anybody using it? Configuration tips? ...

GZipStream: why do we convert to base 64 after compression?

I was just looking at a code sample for compressing a string. I find that using the GZipStream class suffices. But I don't understand why we have to convert it to base 64 string as shown in the example. using System.IO.Compression; using System.Text; using System.IO; public static string Compress(string text) { byte[] buffer = Encoding...

I'm attempting to force gzip compression on a page using GZipStream but the browser says I'm using unsupported compression

I'm tring to implement what Steve Souders discusses http://www.stevesouders.com/blog/2010/07/12/velocity-forcing-gzip-compression/ about forcing gzip compression I've got a module that's running this: void context_PreSendRequestHeaders(object sender, EventArgs e) { var app = sender as HttpApplication; var request = app.Request...

Force flush on a GZIPOutputStream in java

Hi, we are working on a program where we need to flush (force compress and send data) a GZIPOutputStream. The problem is, that the flush method of the GZIPOutputStream doesn't work as expected (force compress and send data), instead the Stream waits for more data for efficient data compression. When you call finish the data is compress...

Android: Gzip/Http supported by default?

I am using the code shown below to get Data from our server where Gzip is turned on. Does my Code already support Gzip (maybe this is already done by android and not by my java program) or do I have to add/change smth.? How can I check that it's using Gzip? For my opionion the download is kinda slow. private static InputStream OpenHtt...

GZipStream is cutting off last part of XML

I have created an extension method called AddGZip which looks like the following: public static void AddGZip(this HttpResponse response) { response.Filter = new GZipStream(response.Filter, CompressionMode.Compress); response.AppendHeader("Content-Encoding", "gzip"); } This is a very cut down version of the code: var response ...

C# SslStream with GZipStream

Is it possible to use GZipStream passing an SslStream in C#? i.e. can you do GZipStream stream = new GZipStream(sslStream, CompressionMode.Compress); stream.Write(...); ... GZipStream stream = new GZipStream(sslStream, CompressionMode.Decompress); stream.Read(...); If this is possible, is the SslStream still in a useable state afte...

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(...

Can GZip compression (via .net) increase file size?

I keep track of the original size of the files that I'm compressing using .Net's GZipStream class, and it seems like the file that I thought I was compressing has increased in size. Is that possible? This is how I'm doing the compression: Byte[] bytes = GetFileBytes(file); using (FileStream fileStream = new FileStream("Zipped.gz", Fil...

GZip decompression stops at arbitrary point

I'm using the .Net GZipStream class to compress and decompress files. After I do the decompression, the data seems fine, but then turns to nothing but zeros after a certain, seemingly arbitrary, point. For example, after decompressing a file, it is the proper 19KB in size, but bytes 10,588 and on are all zeros. I'm not sure what I'm doi...

c# gzipstream decompression is more like depression...

final working code is here.... public static byte[] ToGZip( this string source ) { using( var stream = new MemoryStream( ) ) { using( var compressor = new GZipStream( stream, CompressionMode.Compress ) ) { var bytes = System.Text.UTF8Encoding.UTF8.GetBytes( source ); ...

downloading large amount of files

I'm researching solutions for a potential client. They're requesting the ability to download a large amount of MP3's (1000+) from their online catalog. I've researched/tested building a zip containing all MP3s using ZipArchive but ran into obvious memory leak issues that have ruled that solution out. I'm now trying to think out of the...