ComponentOne Zip for .NET
C1ZStreamWriter Class
Members  Example 

C1.C1Zip.4 Assembly > C1.C1Zip Namespace : C1ZStreamWriter Class
Compresses data into .NET Streams.
Object Model
C1ZStreamWriter ClassZStream Class
Public Class C1ZStreamWriter 
   Inherits System.IO.Stream
public class C1ZStreamWriter : System.IO.Stream 

To compress data into a stream, create a C1ZStreamWriter object passing the stream to the C1ZStreamWriter constructor.

Then write the data into the C1ZStreamWriter using the Write method, or create a System.IO.StreamWriter on the C1ZStreamWriter. The second option is indicated when you want to write formatted data.

When you are done writing the data, call the Close method to flush the data and close the underlying stream.

The code below compresses a string into a memory stream:
public byte[] CompressString(string str)
	// open memory stream
	var ms = new MemoryStream();
	// attach compressor stream to memory stream
	var sw = new C1ZStreamWriter(ms);
	// write data into compressor stream
	var writer = new StreamWriter(sw);
	// flush any pending data
	// return the memory buffer
	return ms.ToArray();
Inheritance Hierarchy


See Also


C1ZStreamWriter Members
C1.C1Zip Namespace