Have you ever wondered how to increase the responsiveness of your applications by compressing the data that you send over the internet? The Q2 2011 release of the RadControls for Silverlight and WPF comes with a new RadZipLibrary which allows you to easily compress data like images, docx or pdf files and send them over the wire. Thus, you will achieve fast and secure transactions.
This is a list with short descriptions of the top-of-the-line features of Telerik’s Zip Library:
Basically when you want to work with the Telerik ZipLibrary, you need to create a ZipPackage object. In order to do so, you can take advantage of the ZipPackage class static methods that allow you to create or open a zip package:
ZipPackage Class Static Methods
When you create a ZipPackage object using the above methods, it populates its ZipPackageEntries collection of ZipPackageEntry elements. You can further manipulate the ZipPackage and its ZipPackageEntries collection using the following methods:
If you need to get the file name of a ZipPackage, you can use the ZipPackage object FileName property.
The ZipPackageEntry class describes each file in the ZipPackage object. It exposes the following properties:
If you want to get the stream that represents the ZipPackageEntry, you can take advantage of the ZipPackageEntry.OpenInputStream() method which returns the Stream of the entry.
Telerik Zip Library provides two classes that are designed to compress and decompress streams – ZipOutputStream and ZipInputStream.
Compressing a Stream
The ZipOutputStream class allows you to compress a stream. You can create a compressed stream by initializing a new instance of the ZipOutputStream class and passing the uncompressed stream as a parameter:
ZipOutputStream zipOutputStream =
While initializing an instance of the ZipOutputStream class you can also pass as a parameter a ZipCompression method:
The ZipCompression method defines the level of compression to be used while compressing the stream.
The ZipOutputStream class derives from the Stream class and therefore it supports all Stream class properties. However, it also exposes a set of properties that provide further information about the compressed stream:
Since the ZipOutputStream class derives from the Stream class it supports all Stream class methods. It also exposes a Cancel() method that can be used to stop the compression.
Decompressing a Stream
The ZipInputStream class allows you to decompress a stream. In order to decompress a Stream object, you can create a new instance of the ZipInputStream class passing the compressed stream as a parameter:
ZipInputStream inputStream = new ZipInputStream(compressedStream);
The ZipInputStream class derives from the Stream class and therefore it supports all Stream class properties. However, it also exposes a set of properties that proved further information about the decompressed stream:
The new RadZipLibrary provides an easy way to manipulate zip files and to compress and decompress streams in your Web or LOB applications, so you can give it a try and feel free to share your feedback in order to make the product better.
Here you can find some examples using the RadZipLibrary
Copyright © 2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.