gzipstream

Computing progress (bar) using GZipStream

I'm reading a .gz file from some slow source (like FTP Server) and am processing the received data right away. Looks something like this: FtpWebResponse response = ftpclientRequest.GetResponse() as FtpWebResponse; using (Stream ftpStream = response.GetResponseStream()) using (GZipStream unzipped = new GZipStream(ftpStream, CompressionMo...

How do I read / write gzipped files?

How do I read / write gzipped files in C++? The iostream wrapper classes here look good, and here is a simple usage example: gz::igzstream in(filename); std::string line; while(std::getline(in, line)){ std::cout << line << std::endl; } But I wasn't able to actually link it (although I have a /usr/lib/libz.a). A simple g++ test-gzs...

How do I determine how large to make my buffer when using GzipStream?

I'm trying to decompress a GZipStream. The problem is that the "Length" property on the stream throws a "NotSupported" exception. How do I know what size to make my buffer when I'm reading the bytes from the stream? Since it's compressed I don't know how large the uncompressed version will be. Any suggestions? ...

GZIPInputStream reading line by line

Hello Folks, I have a file in .gz format. The java class for reading this file is GZIPInputStream. However, this class doesn't extend the BufferedReader class of java. As a result, I am not able to read the file line by line. I need something like this reader = new MyGZInputStream( some constructor of GZInputStream) reader.readLine...

Sending gzipped data in WebRequest?

I have a large amount of data (~100k) that my C# app is sending to my Apache server with mod_gzip installed. I'm attempting to gzip the data first using System.IO.Compression.GZipStream. PHP receives the raw gzipped data, so Apache is not uncompressing it as I would expect. Am I missing something? System.Net.WebRequest req = WebRequest....

weird GzipInputstream problem

Hi all, I have a server that basically caters to multiple clients. I am basically using gzip(input/output)stream to compress the data between client-server. Many clients can send the requests to server at the same time and hence i have a thread to cater to each client. Now, the problem tat i am experiencing is that "randomly" some cli...

Writing to the compression stream is not supported. Using System.IO.GZipStream

Hello.. I am trying to decompress a (.gz) file using the GZipStream class that is included in the .NET framework. I am using the MSDN documentation and I keep getting this exception: "Writing to the compression stream is not supported." Here is the application source: try { var infile = new FileStream(@"C:...

Compressing with Java Decompressing with PHP

I have a situation where a servlet is providing compressed data to a PHP script. I compress the data on the Java side no problem, but PHP seems unable to decompress. Here is the relevent code snippets Java Side: OutputStream o=response.getOutputStream(); GZIPOutputStream gz=new GZIPOutputStream(o); gz.write(GridCoder.encode(rs,id...

C# to Java: Base64String, MemoryStream, GZipStream

I have a Base64 string that's been gzipped in .NET and I would like to convert it back into a string in Java. I'm looking for some Java equivalents to the C# syntax, particularly: Convert.FromBase64String MemoryStream GZipStream Here's the method I'd like to convert: public static string Decompress(string zipText) { byte[] gzipB...

GZIPInputStream implementation for J2ME

Are there any GZIPInputStream implementation for J2ME available. I would prefer an Apache Style License ...

GZipStream decompression performance is poor

I have a .NET 2.0 WinForms app that connects to a backend WAS server. I am using GZipStream to decode data coming back from a HttpWebRequest call made to the server. The data returned is compressed CSV, which Apache is compressing. The entire server stack is Hibernate-->EJB-->Spring-->Apache. For small responses, the performance is f...

GZipStream and decompression

I have code that should do the compression: FileStream fs = new FileStream("g:\\gj.txt", FileMode.Open); FileStream fd = new FileStream("g:\\gj.zip", FileMode.Create); GZipStream csStream = new GZipStream(fd, CompressionMode.Compress); byte[] compressedBuffer = new byte[500]; int offset = 0; ...

.NET GZipStream compress and decompress problem

What is wrong with this code below. I always get FALSE, meaning after compression, decompressed data does not match original value. public static bool Test() { string sample = "This is a compression test of microsoft .net gzip compression method and decompression methods"; System.Text.ASCIIEncoding encodi...

Unzipping ZLIB compressed portions of a binary file

Hi All- I'm reading a file(a flash swf) from .Net 3.5 that has a header which states whether the body of the file/Stream is compressed or not. However, I'm having problems-after I rewrap the basic File stream in a GZipStream, I get an exception stating that "The magic number in GZip header is not correct. Make sure you are passing in a...

How to Decompress nested GZip (TGZ) files in C#

I am receiving a TGZ file that will contain one plain text file along with possibly one or more nested TGZ files. I have figured out how to decompress the main TGZ file and read the plain text file contained in it, but I have not been able to figure out how to recognize and decompress the nested TGZ files. Has anyone come across this p...

Access to request HTTP headers in custom WCF MessageEncoder.

Hi folks, Does anyone know how to get access to request HTTP headers within MessageEncoder.ReadMessage method? It seems that WCF already "knows" request headers at the point of invoking ReadMessage method, at least Content-Type and Content-Length but I cannot get the access to the Content-Encoding header. Basically, I'm trying to utili...

.NET GZipStream, and out of disk space exception

I am using the following code to write to a compressed file that I create new everytime. using (FileStream fs = File.Open(sortOrderFileName, FileMode.Create,FileAccess.Write, FileShare.ReadWrite)) using (System.IO.Compression.GZipStream gzip = new System.IO.Compression.GZipStream(fs, System.IO.Compression.CompressionMode.Compress)) usin...

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

How can I verify that web pages are being gzipped?

I plan to configure weblogic's gzip servlet filter (using weblogicx-gzip.jar) to gzip my web pages. How can I verify that the pages are being sent to the client gzipped? ...

zipping with c#

hi all, i am trying to use GZipStream to create a gz file using c#. my problem is that i have a list that contains strings. and i need to create a password protected zip file, and put in it a text file containing the strings. i don't want to create the textfile, then zip it, and then delete the textfile. i want to directly create a passw...