Reset Method (stream)

DotNetZip

Ionic Zip Library v1.9.1.6 Reset Method (stream)
ReferenceIonic.ZlibParallelDeflateOutputStreamReset(Stream)
Resets the stream for use with another stream.
Declaration Syntax
C# Visual Basic Visual C++
public void Reset(
	Stream stream
)
Public Sub Reset ( _
	stream As Stream _
)
public:
void Reset(
	Stream^ stream
)
Parameters
stream (Stream)
The new output stream for this era.
Remarks
Because the ParallelDeflateOutputStream is expensive to create, it has been designed so that it can be recycled and re-used. You have to call Close() on the stream first, then you can call Reset() on it, to use it again on another stream.
Examples
CopyC#
ParallelDeflateOutputStream deflater = null;
foreach (var inputFile in listOfFiles)
{
    string outputFile = inputFile + ".compressed";
    using (System.IO.Stream input = System.IO.File.OpenRead(inputFile))
    {
        using (var outStream = System.IO.File.Create(outputFile))
        {
            if (deflater == null)
                deflater = new ParallelDeflateOutputStream(outStream,
                                                           CompressionLevel.Best,
                                                           CompressionStrategy.Default,
                                                           true);
            deflater.Reset(outStream);

            while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
            {
                deflater.Write(buffer, 0, n);
            }
        }
    }
}

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)