# CSJ2K.j2k.codestream.writer.FileCodestreamWriter.-ctor

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor*">FileCodestreamWriter Constructor
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor*"></a>
<h4 id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_System_Object_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor(System.Object,System.Int32)">FileCodestreamWriter(object, int)</h4>
<div 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>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public FileCodestreamWriter(object file, int mb)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(file As Object, mb 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.object">object</a></td>
      <td><span class="parametername">file</span></td>
      <td><p>The file where to write the bit stream</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">mb</span></td>
      <td><p>The maximum number of bytes that can be written to the bit
stream.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.ioexception">IOException</a></td>
      <td><p>If an error occurs while trying to open the file
for writing or while writing the magic number.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor*"></a>
<h4 id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_System_String_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor(System.String,System.Int32)">FileCodestreamWriter(string, int)</h4>
<div 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>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public FileCodestreamWriter(string fname, int mb)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(fname As String, mb 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.string">string</a></td>
      <td><span class="parametername">fname</span></td>
      <td><p>The name of file where to write the bit stream</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">mb</span></td>
      <td><p>The maximum number of bytes that can be written to the bit
stream.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.ioexception">IOException</a></td>
      <td><p>If an error occurs while trying to open the file
for writing or while writing the magic number.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="CSJ2K_j2k_codestream_writer_FileCodestreamWriter__ctor_" data-uid="CSJ2K.j2k.codestream.writer.FileCodestreamWriter.#ctor*"></a>
<h4 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)">FileCodestreamWriter(Stream, int)</h4>
<div 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>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public FileCodestreamWriter(Stream os, int mb)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(os As Stream, mb 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.io.stream">Stream</a></td>
      <td><span class="parametername">os</span></td>
      <td><p>The output stream where to write the bit stream.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">mb</span></td>
      <td><p>The maximum number of bytes that can be written to the bit
stream.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.ioexception">IOException</a></td>
      <td><p>If an error occurs while writing the magic
number to the 'os' output stream.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
