Xceed .NET Libraries Documentation
Quick Compression

Welcome to Xceed .NET, .NET Standard and Xamarin Libraries! > Basic Concepts > The Quick classes > Quick Compression

This topic briefly presents some of the simpler overloads of the static methods of the QuickCompression class; for a complete list, see the class's methods in the reference documentation. Also, see the appropriate topics under Task-Based Help for more complete examples.

The data compressed using the QuickCompression class produces unformatted, "raw" data, which results in compressed data that can't identify what compression method was used.  This means that if the compression method that was used is forgotten, it will not be possible to uncompress that data. In addition, the resulting compressed data is never validated, which means that if an error occurs during compression, you will not be notified. 

Therefore, rather than using the QuickCompression class, we suggest you take a look at the compression classes located in the Xceed.Compression.Formats assembly, such as the XceedCompressionStream class, which stores the compression method in the a header as well as computes a CRC for the data and stores it in a footer. When decompressing, it also validates the stored CRC with the decompressed data to make sure that the data is valid.

The methods

Only the simpler overloads are presented here. Other overloads let you specify compression methods and levels, as well as offsets.

The Compress method lets you compress data. 

VB.NET Copy Code
Dim compressedData() As Byte = QuickCompression.Compress( data )
C# Copy Code
byte[] compressedData = QuickCompression.Compress( data )

The Decompress method lets you decompress data. 

VB.NET Copy Code
Dim decompressedData() As Byte = QuickCompression.Decompress(compressedData)
C# Copy Code
byte[] decompressedData = QuickCompression.Decompress( compressedData );