# C1.Zip.ZLib.ZStream

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_Zip_ZLib_ZStream" data-uid="C1.Zip.ZLib.ZStream" class="text-break">ZStream Class
</h1>
  <div class="markdown level0 summary"><p><b>ZStream</b> is the most flexible and hardest to use class in the <b>C1.C1Zip</b> assembly.
It contains a C# implementation of ZLIB's zstream object, which is a general purpose
compressor and decompressor.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><span class="xref">ZStream</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.Zip.ZLib.html">C1.Zip.ZLib</a></h6>
  <h6><strong>Assembly</strong>: C1.Zip.dll</h6>
  <h5 id="C1_Zip_ZLib_ZStream_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class ZStream</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class ZStream</code></pre>
  </div>
  <h5 id="C1_Zip_ZLib_ZStream_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>In most cases, you should be able to use the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> 
and <a class="xref" href="C1.Zip.C1ZStreamWriter.html">C1ZStreamWriter</a> classes instead of <b>ZStream</b>. 
These classes provide friendly and easy-to-use wrappers that hide the ZLIB complexity.</p>
<p>
Use <b>ZStream</b> only if you are familiar with ZLIB and need control over 
the low-level aspects of the data compression or decompression process 
(e.g., to provide your own buffers or compression dictionaries).</p>
<p>
If you choose to use <b>ZStream</b> directly and need technical support, 
please check out the detailed documentation, sample, and articles available 
at http://www.info-zip.org/ or http://www.gzip.org/, the official zlib sites.</p>
<p>
ZLIB is an open-source, patent-free library created by Jean-Loup Gailly and Mark Adler.</p>
</div>
  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Zip_ZLib_ZStream__ctor" data-uid="C1.Zip.ZLib.ZStream.#ctor">
          <a class="xref" href="C1.Zip.ZLib.ZStream.-ctor.html#C1_Zip_ZLib_ZStream__ctor">ZStream()</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <b>ZStream</b> class using an Adler checksum.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream__ctor_System_Boolean_" data-uid="C1.Zip.ZLib.ZStream.#ctor(System.Boolean)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.-ctor.html#C1_Zip_ZLib_ZStream__ctor_System_Boolean_">ZStream(bool)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <b>ZStream</b> class.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="fields">Fields
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_BUF_ERROR" data-uid="C1.Zip.ZLib.ZStream.Z_BUF_ERROR">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_BUF_ERROR.html">Z_BUF_ERROR</a>
        </td>
        <td class="markdown level1 summary"><p>No progress possible or no room in output buffer.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_DATA_ERROR" data-uid="C1.Zip.ZLib.ZStream.Z_DATA_ERROR">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_DATA_ERROR.html">Z_DATA_ERROR</a>
        </td>
        <td class="markdown level1 summary"><p>Input data is corrupted (wrong format or checksum).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_ERRNO" data-uid="C1.Zip.ZLib.ZStream.Z_ERRNO">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_ERRNO.html">Z_ERRNO</a>
        </td>
        <td class="markdown level1 summary"><p>File error.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_MEM_ERROR" data-uid="C1.Zip.ZLib.ZStream.Z_MEM_ERROR">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_MEM_ERROR.html">Z_MEM_ERROR</a>
        </td>
        <td class="markdown level1 summary"><p>Not enough memory.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_NEED_DICT" data-uid="C1.Zip.ZLib.ZStream.Z_NEED_DICT">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_NEED_DICT.html">Z_NEED_DICT</a>
        </td>
        <td class="markdown level1 summary"><p>A preset dictionary is needed at this point.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_OK" data-uid="C1.Zip.ZLib.ZStream.Z_OK">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_OK.html">Z_OK</a>
        </td>
        <td class="markdown level1 summary"><p>No error.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_STREAM_END" data-uid="C1.Zip.ZLib.ZStream.Z_STREAM_END">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_STREAM_END.html">Z_STREAM_END</a>
        </td>
        <td class="markdown level1 summary"><p>End of stream detected.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_STREAM_ERROR" data-uid="C1.Zip.ZLib.ZStream.Z_STREAM_ERROR">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_STREAM_ERROR.html">Z_STREAM_ERROR</a>
        </td>
        <td class="markdown level1 summary"><p>Stream structure is inconsistent (input/output buffers are null for example).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_Z_VERSION_ERROR" data-uid="C1.Zip.ZLib.ZStream.Z_VERSION_ERROR">
          <a class="xref" href="C1.Zip.ZLib.ZStream.Z_VERSION_ERROR.html">Z_VERSION_ERROR</a>
        </td>
        <td class="markdown level1 summary"><p>Incompatible ZLIB version.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_adler" data-uid="C1.Zip.ZLib.ZStream.adler">
          <a class="xref" href="C1.Zip.ZLib.ZStream.adler.html">adler</a>
        </td>
        <td class="markdown level1 summary"><p>Current checksum value (Adler or CRC32).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_avail_in" data-uid="C1.Zip.ZLib.ZStream.avail_in">
          <a class="xref" href="C1.Zip.ZLib.ZStream.avail_in.html">avail_in</a>
        </td>
        <td class="markdown level1 summary"><p>Number of bytes available in the input buffer.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_avail_out" data-uid="C1.Zip.ZLib.ZStream.avail_out">
          <a class="xref" href="C1.Zip.ZLib.ZStream.avail_out.html">avail_out</a>
        </td>
        <td class="markdown level1 summary"><p>Number of free bytes remaining in output buffer.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_msg" data-uid="C1.Zip.ZLib.ZStream.msg">
          <a class="xref" href="C1.Zip.ZLib.ZStream.msg.html">msg</a>
        </td>
        <td class="markdown level1 summary"><p>Description of the last error (null if no errors).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_next_in" data-uid="C1.Zip.ZLib.ZStream.next_in">
          <a class="xref" href="C1.Zip.ZLib.ZStream.next_in.html">next_in</a>
        </td>
        <td class="markdown level1 summary"><p>Input buffer.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_next_in_index" data-uid="C1.Zip.ZLib.ZStream.next_in_index">
          <a class="xref" href="C1.Zip.ZLib.ZStream.next_in_index.html">next_in_index</a>
        </td>
        <td class="markdown level1 summary"><p>Position of cursor into input buffer.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_next_out" data-uid="C1.Zip.ZLib.ZStream.next_out">
          <a class="xref" href="C1.Zip.ZLib.ZStream.next_out.html">next_out</a>
        </td>
        <td class="markdown level1 summary"><p>Output buffer.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_next_out_index" data-uid="C1.Zip.ZLib.ZStream.next_out_index">
          <a class="xref" href="C1.Zip.ZLib.ZStream.next_out_index.html">next_out_index</a>
        </td>
        <td class="markdown level1 summary"><p>Position of cursor into the output buffer.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_total_in" data-uid="C1.Zip.ZLib.ZStream.total_in">
          <a class="xref" href="C1.Zip.ZLib.ZStream.total_in.html">total_in</a>
        </td>
        <td class="markdown level1 summary"><p>Total number of input bytes read so far.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_total_out" data-uid="C1.Zip.ZLib.ZStream.total_out">
          <a class="xref" href="C1.Zip.ZLib.ZStream.total_out.html">total_out</a>
        </td>
        <td class="markdown level1 summary"><p>Total number of bytes output so far.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_deflate_System_Int32_" data-uid="C1.Zip.ZLib.ZStream.deflate(System.Int32)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.deflate.html#C1_Zip_ZLib_ZStream_deflate_System_Int32_">deflate(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Compresses as much data as possible, and stops when the input buffer becomes empty or the
output buffer becomes full.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_deflateEnd" data-uid="C1.Zip.ZLib.ZStream.deflateEnd">
          <a class="xref" href="C1.Zip.ZLib.ZStream.deflateEnd.html#C1_Zip_ZLib_ZStream_deflateEnd">deflateEnd()</a>
        </td>
        <td class="markdown level1 summary"><p>Frees all dynamically allocated data structures for this stream,
discards any unprocessed input, and does not flush any pending output.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_deflateInit_System_Int32_" data-uid="C1.Zip.ZLib.ZStream.deflateInit(System.Int32)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.deflateInit.html#C1_Zip_ZLib_ZStream_deflateInit_System_Int32_">deflateInit(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes the internal stream state for compression.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_deflateInit_System_Int32_System_Int32_" data-uid="C1.Zip.ZLib.ZStream.deflateInit(System.Int32,System.Int32)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.deflateInit.html#C1_Zip_ZLib_ZStream_deflateInit_System_Int32_System_Int32_">deflateInit(int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes the internal stream state for compression.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_deflateParams_System_Int32_System_Int32_" data-uid="C1.Zip.ZLib.ZStream.deflateParams(System.Int32,System.Int32)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.deflateParams.html#C1_Zip_ZLib_ZStream_deflateParams_System_Int32_System_Int32_">deflateParams(int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Dynamically updates the compression level and compression strategy.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_deflateSetDictionary_System_Byte___System_Int32_" data-uid="C1.Zip.ZLib.ZStream.deflateSetDictionary(System.Byte[],System.Int32)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.deflateSetDictionary.html#C1_Zip_ZLib_ZStream_deflateSetDictionary_System_Byte___System_Int32_">deflateSetDictionary(byte[], int)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes the compression dictionary from the given byte sequence without
producing any compressed output.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_inflate_System_Int32_" data-uid="C1.Zip.ZLib.ZStream.inflate(System.Int32)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.inflate.html#C1_Zip_ZLib_ZStream_inflate_System_Int32_">inflate(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Decompresses as much data as possible until the input buffer is exhausted or
the output buffer is full.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_inflateEnd" data-uid="C1.Zip.ZLib.ZStream.inflateEnd">
          <a class="xref" href="C1.Zip.ZLib.ZStream.inflateEnd.html#C1_Zip_ZLib_ZStream_inflateEnd">inflateEnd()</a>
        </td>
        <td class="markdown level1 summary"><p>Frees all dynamically allocated data structures for this stream,
discards any unprocessed input, and does not flush any pending output.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_inflateInit" data-uid="C1.Zip.ZLib.ZStream.inflateInit">
          <a class="xref" href="C1.Zip.ZLib.ZStream.inflateInit.html#C1_Zip_ZLib_ZStream_inflateInit">inflateInit()</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes the internal stream state for decompression.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_inflateInit_System_Int32_" data-uid="C1.Zip.ZLib.ZStream.inflateInit(System.Int32)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.inflateInit.html#C1_Zip_ZLib_ZStream_inflateInit_System_Int32_">inflateInit(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes the internal stream state for decompression.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_inflateSetDictionary_System_Byte___System_Int32_" data-uid="C1.Zip.ZLib.ZStream.inflateSetDictionary(System.Byte[],System.Int32)">
          <a class="xref" href="C1.Zip.ZLib.ZStream.inflateSetDictionary.html#C1_Zip_ZLib_ZStream_inflateSetDictionary_System_Byte___System_Int32_">inflateSetDictionary(byte[], int)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes the decompression dictionary from the given uncompressed byte sequence.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_ZLib_ZStream_inflateSync" data-uid="C1.Zip.ZLib.ZStream.inflateSync">
          <a class="xref" href="C1.Zip.ZLib.ZStream.inflateSync.html#C1_Zip_ZLib_ZStream_inflateSync">inflateSync()</a>
        </td>
        <td class="markdown level1 summary"><p>Skips invalid compressed data until a full flush point is found,
or until all available input is skipped. No output is provided.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
