Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > VB.NET > VB.NET General Discussion

VB.NET General Discussion VB.NET general discussion area

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-10-2009, 3:51 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Apr 2006
Posts: 11
Reputation: 49
stricknyn is on a distinguished programming path ahead
Default Where is the zip file being stored?

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?


Code:
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-10-2009, 4:15 PM
VB.NET Forum Idol
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Feb 2008
Location: USA
Posts: 816
Reputation: 459
MattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond repute
Default

File.Create Method (String) (System.IO)

Quote:
The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-11-2009, 3:03 AM
jmcilhinney's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Aug 2004
Location: Sydney, Australia
Age: 40
Posts: 6,006
Reputation: 538
jmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalist
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-11-2009, 10:18 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Apr 2006
Posts: 11
Reputation: 49
stricknyn is on a distinguished programming path ahead
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-11-2009, 9:32 PM
jmcilhinney's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Aug 2004
Location: Sydney, Australia
Age: 40
Posts: 6,006
Reputation: 538
jmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalist
Default

Quote:
Originally Posted by stricknyn View Post
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-16-2009, 1:17 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Apr 2006
Posts: 11
Reputation: 49
stricknyn is on a distinguished programming path ahead
Default

Thank you so much this helped alot. I'm sure I'll post some more questions in route to my Microsoft certification.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 10:28 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.