# CSJ2K.j2k.codestream.writer.FileCodestreamWriter

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter" class="text-break">FileCodestreamWriter Class
</h1>
  <div class="markdown level0 summary"></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"><a class="xref" href="CSJ2K.j2k.codestream.writer.CodestreamWriter.html">CodestreamWriter</a></div>
    <div class="level2"><span class="xref">FileCodestreamWriter</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="CSJ2K.j2k.codestream.writer.html">CSJ2K.j2k.codestream.writer</a></h6>
  <h6><strong>Assembly</strong>: C1.WPF.ReportViewer.4.6.2.dll</h6>
  <h5 id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class FileCodestreamWriter : CodestreamWriter</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class FileCodestreamWriter
    Inherits CodestreamWriter</code></pre>
  </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="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_System_IO_Stream_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor(System.IO.Stream,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.-ctor.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_System_IO_Stream_System_Int32_">FileCodestreamWriter(Stream, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Uses the output stream 'os' for writing the bit stream, using the 'he'
header encoder. The magic number is written to the bit
stream. Normally, the header encoder must be empty (i.e. no data has
been written to it yet). No BufferedOutputStream is used on top of the
output stream 'os'.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_System_Object_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor(System.Object,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.-ctor.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_System_Object_System_Int32_">FileCodestreamWriter(object, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Opens the file 'file' for writing the codestream. The magic number is
written to the bit stream. Normally, the header encoder must be empty
(i.e. no data has been written to it yet). A BufferedOutputStream is
used on top of the file to increase throughput, the length of the
buffer is DEF_BUF_LEN.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_System_String_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor(System.String,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.-ctor.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_System_String_System_Int32_">FileCodestreamWriter(string, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Opens the file named 'fname' for writing the bit stream, using the 'he'
header encoder. The magic number is written to the bit
stream. Normally, the header encoder must be empty (i.e. no data has
been written to it yet). A BufferedOutputStream is used on top of the
file to increase throughput, the length of the buffer is DEF_BUF_LEN.</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="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_DEF_BUF_LEN" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.DEF_BUF_LEN">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.DEF_BUF_LEN.html">DEF_BUF_LEN</a>
        </td>
        <td class="markdown level1 summary"><p>The default buffer length, 1024 bytes</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_Length" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.Length">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.Length.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter_Length">Length</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the current length of the entire bit stream.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_MaxAvailableBytes" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.MaxAvailableBytes">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.MaxAvailableBytes.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter_MaxAvailableBytes">MaxAvailableBytes</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the number of bytes remaining available in the bit stream. This
is the maximum allowed number of bytes minus the number of bytes that
have already been written to the bit stream. If more bytes have been
written to the bit stream than the maximum number of allowed bytes,
then a negative value is returned.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_OffLastROIPkt" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.OffLastROIPkt">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.OffLastROIPkt.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter_OffLastROIPkt">OffLastROIPkt</a>
        </td>
        <td class="markdown level1 summary"><p>Gives the offset of the end of last packet containing ROI information</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="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_close" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.close">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.close.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter_close">close()</a>
        </td>
        <td class="markdown level1 summary"><p>Writes the EOC marker and closes the underlying stream.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_commitBitstreamHeader_CSJ2K_j2k_codestream_writer_HeaderEncoder_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.commitBitstreamHeader(CSJ2K.j2k.codestream.writer.HeaderEncoder)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.commitBitstreamHeader.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter_commitBitstreamHeader_CSJ2K_j2k_codestream_writer_HeaderEncoder_">commitBitstreamHeader(HeaderEncoder)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes the header data in the codestream and actualize ndata with the
header length. The header is either a MainHeaderEncoder or a
TileHeaderEncoder.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_writePacketBody_System_Byte___System_Int32_System_Boolean_System_Boolean_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.writePacketBody(System.Byte[],System.Int32,System.Boolean,System.Boolean,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.writePacketBody.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter_writePacketBody_System_Byte___System_Int32_System_Boolean_System_Boolean_System_Int32_">writePacketBody(byte[], int, bool, bool, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes a packet body to the codestream and returns the number of bytes
used by this body. If in simulation mode then no data is written to the
bit stream but the number of bytes is calculated. This can be used for
iterative rate allocation.</p>
<pre><code>       &lt;p&gt;If the number of bytes that has to be written to the codestream is
       more than the space left (as returned by getMaxAvailableBytes()), only
       the data that does not exceed the allowed length is effectively written
       and the rest is discarded. However the value returned by the method is
       the total length of the packet, as if all of it was written to the bit
       stream.&lt;/p&gt;
</code></pre>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter_writePacketHead_System_Byte___System_Int32_System_Boolean_System_Boolean_System_Boolean_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.writePacketHead(System.Byte[],System.Int32,System.Boolean,System.Boolean,System.Boolean)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.writePacketHead.html#CSJ2K_j2k_codestream_writer_FileCodestreamWriter_writePacketHead_System_Byte___System_Int32_System_Boolean_System_Boolean_System_Boolean_">writePacketHead(byte[], int, bool, bool, bool)</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
    </tbody>
  </table>

</div>
