473,378 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

compression issues

Hello,

I would like to know which one of the following compressiom methods are
the easiest to implement in c# and the most effective one in compression
of files? (text or code files)

Which one of those: zip, tar, tar.gz, gz. ?
And is there any code sample in C# of the API with compression?

Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Oct 28 '08 #1
9 2673

"csharpula csharp" <cs*******@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hello,

I would like to know which one of the following compressiom methods are
the easiest to implement in c# and the most effective one in compression
of files? (text or code files)

Which one of those: zip, tar, tar.gz, gz. ?
And is there any code sample in C# of the API with compression?
using System;
using System.IO;
using System.IO.Compression;

void static GZFile(string source, string destination)
{
using (
Stream src = File.Open(source, FileMode.Open),
dst = File.Open(destination, FileMode.Create) )
{
Stream gz = new GZipStream(dst, CompressionMode.Compress);
Pump(src, gz);
gz.Flush();
gz.Close();
}
}

This will create a gz file. Note Pump (code not shown) simply chunks a 128K
buffer from one stream to another.

It doesn't get any simpler. However other third party libraries would
probably get better compression.
--
Anthony Jones - MVP ASP/ASP.NET

Oct 28 '08 #2
http://www.codeplex.com/DotNetZip

"csharpula csharp" <cs*******@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hello,

I would like to know which one of the following compressiom methods are
the easiest to implement in c# and the most effective one in compression
of files? (text or code files)

Which one of those: zip, tar, tar.gz, gz. ?
And is there any code sample in C# of the API with compression?

Thank you!

*** Sent via Developersdex http://www.developersdex.com ***

Oct 28 '08 #3


But which one is the most efficent and how to API with it from C#?

Thanks a lot!

*** Sent via Developersdex http://www.developersdex.com ***
Oct 28 '08 #4
On Oct 28, 1:15*pm, csharpula csharp <csharp...@yahoo.comwrote:
But which one is the *most efficent and how to API with it from C#?
Figure it out, do some research, its not hard to do a couple of google
searches about comparisons between compression methods.
Someone gave you the code you would need, what do you mean how to API
with it from c#?
>
Thanks a lot!

*** Sent via Developersdexhttp://www.developersdex.com***
Oct 28 '08 #5
csharpula csharp wrote:
I would like to know which one of the following compressiom methods are
the easiest to implement in c# and the most effective one in compression
of files? (text or code files)

Which one of those: zip, tar, tar.gz, gz. ?
And is there any code sample in C# of the API with compression?
Tar is not compressing at all - it just bundles multiple files
in one file.

Zip and gzip basically use the same compression algorithm
(a combination of LZ77 with Huffman encoding and some
smart tricks). Zip format has the capability to bundle
multiple files in one file - gzip does not.

..NET framework support:
- the basic algorithm
- gzip
in namespace System.IO.Compression !

To get zip you will need something extra like:
- SharpZipLib
- J# runtime library from Microsoft

Arne
Oct 28 '08 #6
So that means that tar.gz and zip are the same from the compression
point of view?

*** Sent via Developersdex http://www.developersdex.com ***
Oct 29 '08 #7
csharpula csharp wrote:
So that means that tar.gz and zip are the same from the compression
point of view?
They use the exact same compression algorithm, but you get
different resulting sizes.

Tar creates a bundle of all the files uncompressed and then
gzip compresses it and just add a tiny header.

Zip bundles and compress all the files individually.

This means that:
- a .tar.gz will often be sligtly smaller than the .zip because
you get better compression when you compressed everything
in one pass instead of compressing each file individually
- you can extract a single file from a zip while with a
.tar.gz even though it may look as if you extract a single
file then in fact you are decompressing the entire thing
(or at least up to where the exacted file are)

I don't know if that makes it same or different in your context.

Arne
Oct 29 '08 #8
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:49***********************@news.sunsite.dk...
csharpula csharp wrote:
>I would like to know which one of the following compressiom methods are
the easiest to implement in c# and the most effective one in compression
of files? (text or code files)

Which one of those: zip, tar, tar.gz, gz. ? And is there any code sample
in C# of the API with compression?

Tar is not compressing at all - it just bundles multiple files
in one file.

Zip and gzip basically use the same compression algorithm
(a combination of LZ77 with Huffman encoding and some
smart tricks). Zip format has the capability to bundle
multiple files in one file - gzip does not.

.NET framework support:
- the basic algorithm
- gzip
in namespace System.IO.Compression !

To get zip you will need something extra like:
- SharpZipLib
- J# runtime library from Microsoft
Another Zip option would be System.IO.Packaging.Package which is
fundementally a Zip file.

--
Anthony Jones - MVP ASP/ASP.NET

Nov 2 '08 #9
tlhintoq
3,525 Expert 2GB
ahmed jadoo3 ( mailto:ahmedjadoo3@yahoo.com ) has reported this post:

compression issues
http://bytes.com/topic/c-sharp/answe...es#post3404196

This is part of this thread:
compression issues
http://bytes.com/topic/c-sharp/answe...ression-issues

This is the reason that the user gave:
i need to insert huffman coding in .net language for arbic text eg.
أ=001
ب=0010
م=1000
and so on
i need this code to my project
please help me fast because my presentation of the project in sunday
When you hit the REPORT link you were told that reporting a post is for SPAM, harrasement and other violations of the Bytes guidelines.



It not a way to draw attention to your problem because you are impatient.

Next time you do it I'll just delete the threat for not following the rules after you have been warned.
May 7 '10 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: | last post by:
Hi, Does .NET have classes or in the near future have classes to allow me to compress N files into one or somehow contain N files in one (even without compression)? If .NET hasnt or wont,...
4
by: jacques | last post by:
Hello, Is there C# sample source code avaible (FREE or inexpensive) that performs Zip compression. TIA, Jacques
1
by: SStory | last post by:
Are there any functions in .NET or Windows that do file compression that I could include in a backup app I am making to sell? I have notice the LZ file operations but wonder would a developer be...
12
by: Mitchell Vincent | last post by:
As the subject suggests, I'm looking for a compression and encryption component(s) for use with VB.NET. I would rather then be all managed code but will use ActiveX/COM if I have to.. Price is...
5
by: Brian Staff | last post by:
I'm using IIS 5 and I've been reading about server to browser HTTP compression using "gzip" or "deflate" encoding. Can this be done in IIS 5? If so, it is a configuration setting or do I need...
0
by: jazaret | last post by:
I've been having a hard time getting the benefits that Unicode Compression offers (2003 Access). I've got a test database that I'd like to set the Unicode Compression for the fields. For this test...
3
by: =?Utf-8?B?Q29kZXJfUmFqaXY=?= | last post by:
I am in the process of developing a web service which will be called from oracle forms. The web service will accept and return huge amount of XML data. So, I need to implement data compression...
6
by: Giorgio Parmeggiani | last post by:
Hi I'm using the gzip compression found in WCG samples kit. It works well, but how can I set the SendTimeout and ReceiveTimeout parameters? Thank in advance Giorgio
14
by: Thomas Mlynarczyk | last post by:
Hello, I have a script that generates XML files which are sent to a client app on request via "new SimpleXMLElement( $sUrl, 0, true )". Both client and server run PHP 5.2 and the XML file can...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.