# CSJ2K.j2k.entropy.encoder.MQCoder.terminate

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="CSJ2K_j2k_entropy_encoder_MQCoder_terminate_" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.terminate*">terminate Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="CSJ2K_j2k_entropy_encoder_MQCoder_terminate_" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.terminate*"></a>
<h4 id="CSJ2K_j2k_entropy_encoder_MQCoder_terminate" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.terminate">terminate()</h4>
<div class="markdown level1 summary"><p>This function flushes the remaining encoded bits and makes sure that
enough information is written to the bit stream to be able to finish
decoding, and then it reinitializes the internal state of the MQ coder
but without modifying the context states.</p>
<pre><code>       &lt;p&gt;After calling this method the 'finishLengthCalculation()' method
       should be called, after compensating the returned length for the length
       of previous coded segments, so that the length calculation is
       finalized.&lt;/p&gt;&lt;p&gt;The type of termination used depends on the one specified at the
       constructor.&lt;/p&gt;
</code></pre>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public virtual int terminate()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Overridable Function terminate() As Integer</code></pre>
</div>
<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>The length of the arithmetic codeword after termination, in
bytes.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
