BT

Your opinion matters! Please fill in the InfoQ Survey!

Microsoft .NET Finally Offers a General Purpose Zip Library

| by Jonathan Allen Follow 203 Followers on May 23, 2012. Estimated reading time: 1 minute |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

The .NET Framework has always had a weird relationship with the Zip file format. From the very beginning .NET actually did support Zip files, but in a way most people didn’t realize. The long since abandoned J# programming language included Java’s java.util.zip package. In a 2003 article by Ianier Munoz, one can see how to use J# Zip libraries in C#.

.NET 2.0 was very much a step backwards in this area. By then J# was already largely forgotten by the developer community and instead we were offered the nearly useless IO.Compression namespace. The DeflateStream and GZipStream classes only offered single pass, stream-based compression. Furthermore they lack the ability to handle the metadata associated with multiple file archives such as Zip.

In 2006 Microsoft offered an uncharacteristically clumsy API for Zip files via the ZipPackage class. This API was created mainly to support the Open XML Paper Specification (XPS). The XPS was originally seen as an attempt to compete directly with Adobe’s PDF file format, but those efforts have been largely abandoned. Today XPS is used for the Windows print spooler, replacing the GDI-based WinPrint if the printer supports it.

For .NET 4.5 we are finally seeing a built-in API for Zip files worth looking at. While it is still too soon to tell if the ZipArchive class is a real competitor to libraries such as DotNetZip, it at least offers something usable to those who are unable to use open source libraries due to licensing issues. Tugberk Ugurlu has a walkthrough showing how to use ZipArchive in .NET 4.5.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT