VB example Visual C++ example Delphi example C# example VB.NET example
In the descriptions below, you can freely replace the word "compress" with "decompress" in order to find out how to decompress data, because compressing and decompressing works exactly the same way.
To compress data entirely in memory, from one memory buffer to another in a single pass, perform the following 4 steps. Put the Xceed Streaming Compression control on a form or instantiate it, then:
Specify the format for the resulting compressed data. To do this, set the CompressionFormat property.
Tell the library to compress. To do this, call the Compress method, passing your source memory buffer and specifying True for the bEndOfData parameter.
Obtain the compressed data. To do this, assign the return value of the Compress method to the variable of your choice.
Make sure that everything worked properly. To do this, use your language's error handling object or error handling capabilities. The Xceed Streaming Compression Library supports standard COM error handling functionality.
To compress data entirely in memory while providing the library with data to compress as it becomes available, perform the following 5 steps. Put the Xceed Streaming Compression control on a form or instantiate it, then:
Specify the format for the resulting compressed data. To do this, set the CompressionFormat property.
Provide each block of data to the library as it becomes available. To do this, call the Compress method for each portion of data, passing the memory buffer with a portion of the data and specifying False for the bEndOfData parameter.
Accumulate the compressed data. To do this, append the data returned by the Compress method to a variable which contains the complete compressed memory buffer so far. You can also process the compressed data as it is returned by the library or pass it to other streaming methods.
Continue providing blocks of data to compress until you're done. When there is no more data to compress, call the Compress method with a final (or empty) block of data to compress and specify True for the bEndOfData parameter. Be sure to assign the Compress method's final returned compressed data to your accumulation variable or process it or pass it to other streaming methods.
Make sure that everything worked properly. To do this, use your language's error handling object or error handling capabilities. The Xceed Streaming Compression Library supports standard COM error handling functionality.