C# Streaming Decompression Example (from System.IO.Stream –> System.IO.Stream)
// Streaming decompression from System.IO.Stream --> System.IO.Stream // In this example, the source and sink streams are files. // However, they can be any type of System.IO.Stream, such as a System.Net.Sockets.NetworkStream System.IO.FileStream fsSource = File.OpenRead("qa_data/image.compressed"); Chilkat.StreamConnector scSource = new Chilkat.StreamConnector(); System.IO.FileStream fsSink = File.OpenWrite("qa_data/image.bmp"); Chilkat.StreamConnector scSink = new Chilkat.StreamConnector(); Chilkat.Compression compress = new Chilkat.Compression(); compress.Algorithm = "deflate"; // Create a Chilkat.Stream object, and set the source/sink to the System.IO.Stream objects. Chilkat.Stream stream = new Chilkat.Stream(); scSource.SetAsSource(fsSource, stream); scSink.SetAsSink(fsSink, stream); // Do the streaming decompress -- reading from fsSource and writing to fsSink bool success = compress.DecompressStream(stream);
admin
0
Tags :