# C1.Zip.ZLib.ZStream.deflate

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Zip_ZLib_ZStream_deflate_" data-uid="C1.Zip.ZLib.ZStream.deflate*">deflate Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Zip_ZLib_ZStream_deflate_" data-uid="C1.Zip.ZLib.ZStream.deflate*"></a>
<h4 id="C1_Zip_ZLib_ZStream_deflate_System_Int32_" data-uid="C1.Zip.ZLib.ZStream.deflate(System.Int32)">deflate(int)</h4>
<div 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>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int deflate(int flush)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function deflate(flush As Integer) As Integer</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">flush</span></td>
      <td><p>Non-zero to force some data to be flushed into the output buffer.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><p>Zero on success, an error code on failure.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Zip_ZLib_ZStream_deflate_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p><b>deflate</b> performs one or both of the following actions:</p>
<p>1. Compress more input starting at <b>next_in</b> and update <b>next_in</b> and 
<b>avail_in</b> accordingly. If not all input can be processed (because there is not 
enough room in the output buffer), <b>next_in</b> and <b>avail_in</b> are updated and 
processing will resume at this point for the next call to <b>deflate</b>.</p>
<p>2. Provide more output starting at <b>next_out</b> and update <b>next_out</b> and 
<b>avail_out</b> accordingly. This action is forced if the parameter <code class="paramref">flush</code> is 
non zero. Forcing flush frequently degrades the compression ratio, so this parameter 
should be set only when necessary (in interactive applications). Some output may be 
provided even if flush is not set</p>
<p>This method may introduce some output latency (reading input without producing 
any output) except when forced to flush.</p>
<p>If <b>deflate</b> returns with <b>avail_out</b> == 0, this method must be called 
again with the same value of the <code class="paramref">flush</code> parameter and more output space 
until the flush is complete (<b>deflate</b> returns with <b>avail_out</b> != 0).</p>
</div>
</div>
