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
Syntax
Public Class C1ZStreamWriter 
   Inherits System.IO.Stream
public class C1ZStreamWriter : System.IO.Stream 
Remarks

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.

Example
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);
	writer.Write(str);
	
	// flush any pending data
	writer.Flush();
	
	// return the memory buffer
	return ms.ToArray();
}
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.IO.Stream
         C1.C1Zip.C1ZStreamWriter

See Also

Reference

C1ZStreamWriter Members
C1.C1Zip Namespace