'Declaration
Public Class C1ZStreamWriter Inherits System.IO.Stream
public class C1ZStreamWriter : System.IO.Stream
'Declaration
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 Dispose(Boolean) method to flush the data and close the underlying 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(); }
System.Object
System.MarshalByRefObject
System.IO.Stream
C1.C1Zip.C1ZStreamWriter