Where is the zip file being stored?

stricknyn

Member
Joined
Apr 25, 2006
Messages
11
Programming Experience
5-10
Hi all, I'm sdudying for the Microsoft Exam 70-536 and I'm working through some examples in the self paced book.

In looking at the following code example and trying to figure out the GZipStream class I do not see where the data.zip file is being saved. Is there some default path this goes?


VB.NET:
Dim gzOut As GZipStream = New GZipStream(File.Create("data.zip"), CompressionMode.Compress)
        Dim sw As StreamWriter = New StreamWriter(gzOut)

        For i As Integer = 1 To 999
            sw.Write("Hello World!")
        Next

        sw.Close()
        gzOut.Close()

Thanks,

Strick
 
You should be aware that the GZipStream class does NOT create a ZIP file. It's inappropriate for you to give it a ".zip" extension because it does not have the ZIP format. The GzipStream class creates a GZIP file, which is a different format. You should give the file the standard ".gz" or, if you prefer, ".gzip" extension.
 
Thanks guys,

Also in response to your post jmcilhinney; thank you because that really clarifies some things. In the book this is the exact code sample they used so I was a little confused as to if this compression class was meant to create and read .zip files or really just to compress/decompress text files for transfer.

Strick
 
Thanks guys,

Also in response to your post jmcilhinney; thank you because that really clarifies some things. In the book this is the exact code sample they used so I was a little confused as to if this compression class was meant to create and read .zip files or really just to compress/decompress text files for transfer.

Strick
GZIP is a well-used compression format that, like pretty much any other compression format, works on binary data. You can compress anything you like using GZIP, just as you can with ZIP. The major practical difference between the two is that ZIP files can contain multiple source files where GZIP files can only contain one.

To get around this limitation, most people use the TAR format to combine multiple files into one in an uncompressed format, then compress the TAR file into a GZIP file. Such files normally have a ".tar.gz" or ".tgz" extension and are affectionately known as "tar balls".

The adavantage is that the compression is generally more efficient than the ZIP format. The disadvantage is that you must decompress the entire GZIP file to be able to get one of the source files out of the TAR file, where ZIP files allow you to decompress a single source file.
 
Back
Top