C1.C1Zip Namespace : C1ZStreamWriter Class |
'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 Close 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
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2