# C1.Zip.C1ZStreamReader

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_Zip_C1ZStreamReader" data-uid="C1.Zip.C1ZStreamReader" class="text-break">C1ZStreamReader Class
</h1>
  <div class="markdown level0 summary"><p>Decompresses data from .NET streams.</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"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.marshalbyrefobject">MarshalByRefObject</a></div>
    <div class="level2"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a></div>
    <div class="level3"><span class="xref">C1ZStreamReader</span></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.Zip.html">C1.Zip</a></h6>
  <h6><strong>Assembly</strong>: C1.Zip.dll</h6>
  <h5 id="C1_Zip_C1ZStreamReader_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class C1ZStreamReader : Stream, IDisposable</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class C1ZStreamReader
    Inherits Stream
    Implements IDisposable</code></pre>
  </div>
  <h5 id="C1_Zip_C1ZStreamReader_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>To decompress data from a compressed stream, create a <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> object 
passing the compressed stream to the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> constructor.</p>
<p>Then read the data from the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> using the <a class="xref" href="C1.Zip.C1ZStreamReader.Read.html#C1_Zip_C1ZStreamReader_Read_System_Byte___System_Int32_System_Int32_">Read(byte[], int, int)</a>
method, or create a <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.streamreader">StreamReader</a> on the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a>. 
The second option is indicated when you want to read formatted data.</p>
</div>
  <h5 id="C1_Zip_C1ZStreamReader_examples"><strong>Examples</strong></h5>
  <p>The code below decompresses a string that was stored into a memory stream object:</p>
<pre><code class="lang-csharp">public string ExpandString(byte[] buffer)
{
	// turn buffer into a memory stream
	var ms = new MemoryStream(buffer);

	// attach decompressor stream to memory stream
	var sr = new C1ZStreamReader(ms);

	// read uncompressed data
	var reader = new StreamReader(sr);
	return reader.ReadToEnd();
}</code></pre>

  <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_C1ZStreamReader__ctor_System_IO_Stream_" data-uid="C1.Zip.C1ZStreamReader.#ctor(System.IO.Stream)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.-ctor.html#C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_">C1ZStreamReader(Stream)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> class.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_" data-uid="C1.Zip.C1ZStreamReader.#ctor(System.IO.Stream,System.Boolean)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.-ctor.html#C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_">C1ZStreamReader(Stream, bool)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> class.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_System_Boolean_" data-uid="C1.Zip.C1ZStreamReader.#ctor(System.IO.Stream,System.Boolean,System.Boolean)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.-ctor.html#C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_System_Boolean_">C1ZStreamReader(Stream, bool, bool)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> class.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_System_Int32_" data-uid="C1.Zip.C1ZStreamReader.#ctor(System.IO.Stream,System.Boolean,System.Int32)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.-ctor.html#C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_System_Int32_">C1ZStreamReader(Stream, bool, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> class.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_System_Int32_System_Int32_" data-uid="C1.Zip.C1ZStreamReader.#ctor(System.IO.Stream,System.Boolean,System.Int32,System.Int32)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.-ctor.html#C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_System_Int32_System_Int32_">C1ZStreamReader(Stream, bool, int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> class.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_System_Int64_System_Int32_" data-uid="C1.Zip.C1ZStreamReader.#ctor(System.IO.Stream,System.Boolean,System.Int64,System.Int32)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.-ctor.html#C1_Zip_C1ZStreamReader__ctor_System_IO_Stream_System_Boolean_System_Int64_System_Int32_">C1ZStreamReader(Stream, bool, long, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> class.</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="C1_Zip_C1ZStreamReader_BaseStream" data-uid="C1.Zip.C1ZStreamReader.BaseStream">
          <a class="xref" href="C1.Zip.C1ZStreamReader.BaseStream.html#C1_Zip_C1ZStreamReader_BaseStream">BaseStream</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the underlying stream that contains the compressed data.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_CanRead" data-uid="C1.Zip.C1ZStreamReader.CanRead">
          <a class="xref" href="C1.Zip.C1ZStreamReader.CanRead.html#C1_Zip_C1ZStreamReader_CanRead">CanRead</a>
        </td>
        <td class="markdown level1 summary"><p>Always returns True.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_CanSeek" data-uid="C1.Zip.C1ZStreamReader.CanSeek">
          <a class="xref" href="C1.Zip.C1ZStreamReader.CanSeek.html#C1_Zip_C1ZStreamReader_CanSeek">CanSeek</a>
        </td>
        <td class="markdown level1 summary"><p>Always returns False.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_CanWrite" data-uid="C1.Zip.C1ZStreamReader.CanWrite">
          <a class="xref" href="C1.Zip.C1ZStreamReader.CanWrite.html#C1_Zip_C1ZStreamReader_CanWrite">CanWrite</a>
        </td>
        <td class="markdown level1 summary"><p>Always returns False.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_Length" data-uid="C1.Zip.C1ZStreamReader.Length">
          <a class="xref" href="C1.Zip.C1ZStreamReader.Length.html#C1_Zip_C1ZStreamReader_Length">Length</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the length of the compressed stream if it is known (or -1 if the
length of the compressed stream is unknown).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_OwnsBaseStream" data-uid="C1.Zip.C1ZStreamReader.OwnsBaseStream">
          <a class="xref" href="C1.Zip.C1ZStreamReader.OwnsBaseStream.html#C1_Zip_C1ZStreamReader_OwnsBaseStream">OwnsBaseStream</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether calling the <a class="xref" href="C1.Zip.C1ZStreamReader.Close.html#C1_Zip_C1ZStreamReader_Close">Close()</a> method will also close the underlying stream (see <a class="xref" href="C1.Zip.C1ZStreamReader.BaseStream.html#C1_Zip_C1ZStreamReader_BaseStream">BaseStream</a>).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_Position" data-uid="C1.Zip.C1ZStreamReader.Position">
          <a class="xref" href="C1.Zip.C1ZStreamReader.Position.html#C1_Zip_C1ZStreamReader_Position">Position</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the position within the stream (read-only).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_SizeCompressed" data-uid="C1.Zip.C1ZStreamReader.SizeCompressed">
          <a class="xref" href="C1.Zip.C1ZStreamReader.SizeCompressed.html#C1_Zip_C1ZStreamReader_SizeCompressed">SizeCompressed</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the number of bytes in the stream (compressed bytes).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_SizeCompressedLong" data-uid="C1.Zip.C1ZStreamReader.SizeCompressedLong">
          <a class="xref" href="C1.Zip.C1ZStreamReader.SizeCompressedLong.html#C1_Zip_C1ZStreamReader_SizeCompressedLong">SizeCompressedLong</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the number of bytes in the stream (compressed bytes).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_SizeUncompressed" data-uid="C1.Zip.C1ZStreamReader.SizeUncompressed">
          <a class="xref" href="C1.Zip.C1ZStreamReader.SizeUncompressed.html#C1_Zip_C1ZStreamReader_SizeUncompressed">SizeUncompressed</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the number of bytes that were compressed into the stream (uncompressed bytes).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_SizeUncompressedLong" data-uid="C1.Zip.C1ZStreamReader.SizeUncompressedLong">
          <a class="xref" href="C1.Zip.C1ZStreamReader.SizeUncompressedLong.html#C1_Zip_C1ZStreamReader_SizeUncompressedLong">SizeUncompressedLong</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the number of bytes that were compressed into the stream (uncompressed bytes).</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_ZStream" data-uid="C1.Zip.C1ZStreamReader.ZStream">
          <a class="xref" href="C1.Zip.C1ZStreamReader.ZStream.html#C1_Zip_C1ZStreamReader_ZStream">ZStream</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the ZStream instance wrapped by this <a class="xref" href="C1.Zip.C1ZStreamWriter.html">C1ZStreamWriter</a>.</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_C1ZStreamReader_Close" data-uid="C1.Zip.C1ZStreamReader.Close">
          <a class="xref" href="C1.Zip.C1ZStreamReader.Close.html#C1_Zip_C1ZStreamReader_Close">Close()</a>
        </td>
        <td class="markdown level1 summary"><p>Closes the current stream compressor and flushed any pending data into the base stream.</p>
<p>If the <a class="xref" href="C1.Zip.C1ZStreamReader.OwnsBaseStream.html#C1_Zip_C1ZStreamReader_OwnsBaseStream">OwnsBaseStream</a> property is set to True (the default value), 
then this method also closes the base stream and releases any resources (such as sockets 
and file handles) associated with it.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_Flush" data-uid="C1.Zip.C1ZStreamReader.Flush">
          <a class="xref" href="C1.Zip.C1ZStreamReader.Flush.html#C1_Zip_C1ZStreamReader_Flush">Flush()</a>
        </td>
        <td class="markdown level1 summary"><p>Clears all buffers for this stream and causes any buffered data to be written to the underlying
stream.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_Read_System_Byte___System_Int32_System_Int32_" data-uid="C1.Zip.C1ZStreamReader.Read(System.Byte[],System.Int32,System.Int32)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.Read.html#C1_Zip_C1ZStreamReader_Read_System_Byte___System_Int32_System_Int32_">Read(byte[], int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Reads a sequence of bytes from the underlying compressed stream, decompressing them into
a buffer, then advances the position within the stream by the number of bytes read.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_ReadByte" data-uid="C1.Zip.C1ZStreamReader.ReadByte">
          <a class="xref" href="C1.Zip.C1ZStreamReader.ReadByte.html#C1_Zip_C1ZStreamReader_ReadByte">ReadByte()</a>
        </td>
        <td class="markdown level1 summary"><p>Reads a byte from the stream and advances the position within the stream
by one byte, or returns -1 if at the end of the stream.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_Seek_System_Int64_System_IO_SeekOrigin_" data-uid="C1.Zip.C1ZStreamReader.Seek(System.Int64,System.IO.SeekOrigin)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.Seek.html#C1_Zip_C1ZStreamReader_Seek_System_Int64_System_IO_SeekOrigin_">Seek(long, SeekOrigin)</a>
        </td>
        <td class="markdown level1 summary"><p>Not supported.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_SetLength_System_Int64_" data-uid="C1.Zip.C1ZStreamReader.SetLength(System.Int64)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.SetLength.html#C1_Zip_C1ZStreamReader_SetLength_System_Int64_">SetLength(long)</a>
        </td>
        <td class="markdown level1 summary"><p>Sets the number of compressed bytes to read from the underlying stream.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Zip_C1ZStreamReader_Write_System_Byte___System_Int32_System_Int32_" data-uid="C1.Zip.C1ZStreamReader.Write(System.Byte[],System.Int32,System.Int32)">
          <a class="xref" href="C1.Zip.C1ZStreamReader.Write.html#C1_Zip_C1ZStreamReader_Write_System_Byte___System_Int32_System_Int32_">Write(byte[], int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>This method is overridden and is not supported by the <a class="xref" href="C1.Zip.C1ZStreamReader.html">C1ZStreamReader</a> class.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
