Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

ASP.NET with 2.0/3.5, Silverlight 2/3/4, WPF, WCF, nHibernet, Javascript, Jquery, Ajax, C#-2.0/3.0, Sql server 2005/2008, MySql 5.1., RIA WCF Service, Entity Framework.
Browse by Tags · View All
.Net 8
SQL 5
Sql Server 3
T SQL 3
linq 3
ORM 2
ORM 2
Browser 2
Silverlight 2
C# 2

Archive · View All
December 2011 9
January 2012 4
July 2012 3
October 2012 1
September 2012 1
August 2012 1
May 2012 1
April 2012 1
March 2012 1
February 2012 1

Create Zip File Using .Net

Dec 23 2011 12:32PM by Viral Sarvaiya   

in the dotnet framework there are two method for compressing data 1) GZip 2)Deflate

here i am using GZip Stream (System.IO.Compression).

Steps

1) Create Simple Web Application (asp.net with C#). 2) put below control in to page. 2.1) Button (id=”btnCompress”) 3) put below code in to click event of button.

//create one folder in the project (txt) 
//get the folder physical path  
string filepath = Server.MapPath("txt"); 
//create file  
StreamWriter sw = new StreamWriter(filepath + @"\1.txt"); 
sw.WriteLine("we compress this file after few min."); 
sw.Close(); 
//open 1.txt file  
FileStream objFile = File.OpenRead(filepath + @"\" + "1.txt"); 
//create zip file  
FileStream objZipFile = File.Create(filepath + @"\zip.gz");  
//this is compress stream  
System.IO.Compression.GZipStream objGZip = new System.IO.Compression.GZipStream(objZipFile, CompressionMode.Compress); 
//Read Bytes From Destination File 
int bytes = objFile.ReadByte(); 
while (bytes != -1) 
{ 
    //write byte in Compress File 
    objGZip.WriteByte((byte)bytes); 
    bytes = objFile.ReadByte(); 
} 
objGZip.Close(); objZipFile.Close();

Enjoy...

Jay Ganesh

Tags: .Net, Zip, Create Zip, Compression, C#, C#.Net


Viral Sarvaiya
176 · 1% · 279
3
 
0
Lifesaver
 
0
Refreshed
 
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Create Zip File Using .Net" rated 5 out of 5 by 3 readers
Create Zip File Using .Net , 5.0 out of 5 based on 3 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]