Beispiel #1
0
 /// <summary>
 /// Create a GZipStream using the specified CompressionMode and the specified CompressionLevel,
 /// and explicitly specify whether the stream should be left open after Deflation or Inflation.
 /// </summary>
 /// <remarks>
 /// <para>
 /// This constructor allows the application to request that the captive stream remain open after
 /// the deflation or inflation occurs.  By default, after Close() is called on the stream, the 
 /// captive stream is also closed. In some cases this is not desired, for example if the stream 
 /// is a memory stream that will be re-read after compressed data has been written to it.  Specify true for the 
 /// leaveOpen parameter to leave the stream open. 
 /// </para>
 /// <para>
 /// As noted in the class documentation, 
 /// the CompressionMode (Compress or Decompress) also establishes the "direction" of the stream.  
 /// A GZipStream with CompressionMode.Compress works only through Write().  A GZipStream with 
 /// CompressionMode.Decompress works only through Read().
 /// </para>
 /// </remarks>
 /// <example>
 /// This example shows how to use a DeflateStream to compress data.
 /// <code>
 /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
 /// {
 ///     using (var raw = System.IO.File.Create(outputFile))
 ///     {
 ///         using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true))
 ///         {
 ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
 ///             int n;
 ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
 ///             {
 ///                 compressor.Write(buffer, 0, n);
 ///             }
 ///         }
 ///     }
 /// }
 /// </code>
 /// <code lang="VB">
 /// Dim outputFile As String = (fileToCompress &amp; ".compressed")
 /// Using input As Stream = File.OpenRead(fileToCompress)
 ///     Using raw As FileStream = File.Create(outputFile)
 ///     Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True)
 ///         Dim buffer As Byte() = New Byte(4096) {}
 ///         Dim n As Integer = -1
 ///         Do While (n &lt;&gt; 0)
 ///             If (n &gt; 0) Then
 ///                 compressor.Write(buffer, 0, n)
 ///             End If
 ///             n = input.Read(buffer, 0, buffer.Length)
 ///         Loop
 ///     End Using
 ///     End Using
 /// End Using
 /// </code>
 /// </example>
 /// <param name="stream">The stream which will be read or written.</param>
 /// <param name="mode">Indicates whether the GZipStream will compress or decompress.</param>
 /// <param name="leaveOpen">true if the application would like the stream to remain open after inflation/deflation.</param>
 /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
 public GZipStream(Stream stream)
 {
     this.BaseStream = new ZlibBaseStream(stream, ZlibStreamFlavor.Gzip, false);
 }
Beispiel #2
0
		public ZlibStream(System.IO.Stream stream)
		{
			_baseStream = new ZlibBaseStream(stream, ZlibStreamFlavor.ZLIB, false);
		}
Beispiel #3
0
 /// <summary>
 /// Create a GZipStream using the specified CompressionMode and the specified CompressionLevel,
 /// and explicitly specify whether the stream should be left open after Deflation or Inflation.
 /// </summary>
 /// <remarks>
 /// <para>
 /// This constructor allows the application to request that the captive stream remain open after
 /// the deflation or inflation occurs.  By default, after Close() is called on the stream, the 
 /// captive stream is also closed. In some cases this is not desired, for example if the stream 
 /// is a memory stream that will be re-read after compressed data has been written to it.  Specify true for the 
 /// leaveOpen parameter to leave the stream open. 
 /// </para>
 /// <para>
 /// As noted in the class documentation, 
 /// the CompressionMode (Compress or Decompress) also establishes the "direction" of the stream.  
 /// A GZipStream with CompressionMode.Compress works only through Write().  A GZipStream with 
 /// CompressionMode.Decompress works only through Read().
 /// </para>
 /// </remarks>
 /// <example>
 /// This example shows how to use a DeflateStream to compress data.
 /// <code>
 /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
 /// {
 ///     using (var raw = System.IO.File.Create(outputFile))
 ///     {
 ///         using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true))
 ///         {
 ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
 ///             int n;
 ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
 ///             {
 ///                 compressor.Write(buffer, 0, n);
 ///             }
 ///         }
 ///     }
 /// }
 /// </code>
 /// <code lang="VB">
 /// Dim outputFile As String = (fileToCompress &amp; ".compressed")
 /// Using input As Stream = File.OpenRead(fileToCompress)
 ///     Using raw As FileStream = File.Create(outputFile)
 ///     Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True)
 ///         Dim buffer As Byte() = New Byte(4096) {}
 ///         Dim n As Integer = -1
 ///         Do While (n &lt;&gt; 0)
 ///             If (n &gt; 0) Then
 ///                 compressor.Write(buffer, 0, n)
 ///             End If
 ///             n = input.Read(buffer, 0, buffer.Length)
 ///         Loop
 ///     End Using
 ///     End Using
 /// End Using
 /// </code>
 /// </example>
 /// <param name="stream">The stream which will be read or written.</param>
 /// <param name="mode">Indicates whether the GZipStream will compress or decompress.</param>
 /// <param name="leaveOpen">true if the application would like the stream to remain open after inflation/deflation.</param>
 /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
 public GZipStream(Stream stream)
 {
     this._baseStream = new ZlibBaseStream(stream, ZlibStreamFlavor.GZIP, false);
 }
Beispiel #4
0
 public ZlibStream(Stream stream)
 {
     this.BaseStream = new ZlibBaseStream(stream, ZlibStreamFlavor.Zlib, false);
 }
Beispiel #5
0
 public ZlibStream(Stream stream)
 {
     this.BaseStream = new ZlibBaseStream(stream, ZlibStreamFlavor.Zlib, false);
 }
Beispiel #6
0
 public ZlibStream(System.IO.Stream stream)
 {
     _baseStream = new ZlibBaseStream(stream, ZlibStreamFlavor.ZLIB, false);
 }