System
2.0.0.0
4.0.0.0
System.IO.Stream
This class represents the Deflate algorithm, which is an industry-standard algorithm for lossless file compression and decompression. Starting with the net_v45, the class uses the zlib library. As a result, it provides a better compression algorithm and, in most cases, a smaller compressed file than it provides in earlier versions of the .NET Framework.
This class does not inherently provide functionality for adding files to or extracting files from zip archives. To work with zip archives, use the and the classes.
The class uses the same compression algorithm as the gzip data format used by the class.
The compression functionality in and is exposed as a stream. Data is read on a byte-by-byte basis, so it is not possible to perform multiple passes to determine the best method for compressing entire files or large blocks of data. The and classes are best used on uncompressed sources of data. If the source data is already compressed, using these classes may actually increase the size of the stream.
Provides methods and properties for compressing and decompressing streams by using the Deflate algorithm.
Constructor
4.0.0.0
System.MonoTODO
You use this constructor when you want to specify whether compression efficiency or speed is more important for an instance of the class.
This constructor overload uses the compression mode . To set the compression mode to another value, use the or overload.
Initializes a new instance of the class by using the specified stream and compression level.
The stream to compress.
One of the enumeration values that indicates whether to emphasize speed or compression efficiency when compressing the stream.
Constructor
2.0.0.0
4.0.0.0
To be added.
By default, owns the underlying stream, so closing the stream also closes the underlying stream. Note that the state of the underlying stream can affect the usability of the stream. Also, no explicit checks are performed, so no additional exceptions are thrown when the new instance is created.
If an instance of the class is created with the parameter equal to Compress, header information is inserted immediately. If no further action occurs, the stream appears as a valid, empty, compressed file.
Using the class to compress a file larger than 4 GB raises an exception.
By default, the compression level is set to when the compression mode is .
Initializes a new instance of the class by using the specified stream and compression mode.
One of the enumeration values that indicates whether to compress or decompress the stream.
Constructor
4.0.0.0
System.MonoTODO
You use this constructor when you want to specify whether compression efficiency or speed is more important for an instance of the class, and whether to leave the stream object open after disposing the object.
This constructor overload uses the compression mode . To set the compression mode to another value, use the or overload.
Initializes a new instance of the class by using the specified stream and compression level, and optionally leaves the stream open.
The stream to compress.
One of the enumeration values that indicates whether to emphasize speed or compression efficiency when compressing the stream.
true to leave the stream object open after disposing the object; otherwise, false.
Constructor
2.0.0.0
4.0.0.0
To be added.
By default, owns the underlying stream, so closing the stream also closes the underlying stream. Note that the state of the underlying stream can affect the usability of the stream. Also, no explicit checks are performed, so no additional exceptions are thrown when the new instance is created.
If an instance of the class is created with the parameter equal to Compress, header information is inserted immediately. If no further action occurs, the stream appears as a valid, empty, compressed file.
Using the class to compress a file larger than 4 GB raises an exception.
By default, the compression level is set to when the compression mode is .
Initializes a new instance of the class by using the specified stream and compression mode, and optionally leaves the stream open.
One of the enumeration values that indicates whether to compress or decompress the stream.
true to leave the stream open after disposing the object; otherwise, false.
Property
2.0.0.0
4.0.0.0
System.IO.Stream
To be added.
To be added.
Gets a reference to the underlying stream.
Method
2.0.0.0
4.0.0.0
System.IAsyncResult
To be added.
To be added.
To be added.
Starting with the net_v45, you can perform asynchronous read operations by using the method. The method is still available in the net_v45 to support legacy code; however, you can implement asynchronous I/O operations more easily by using the new async methods. For more information, see Asynchronous File I/O.
Pass the return value to the method of the stream to determine how many bytes were read and to release operating system resources used for reading. You can do this either by using the same code that called or in a callback passed to .
The current position in the stream is updated when the asynchronous read or write operation is issued, not when the I/O operation completes.
Multiple simultaneous asynchronous requests render the request completion order uncertain.
Use the property to determine whether the current object supports reading.
If a stream is closed or you pass an invalid argument, exceptions are thrown immediately from . Errors that occur during an asynchronous read request, such as a disk failure during the I/O request, occur on the thread pool thread and throw exceptions when calling .
Begins an asynchronous read operation. (Consider using the method instead; see the Remarks section.)
An object that represents the asynchronous read operation, which could still be pending.
The byte offset in at which to begin reading data from the stream.
The maximum number of bytes to read.
Method
2.0.0.0
4.0.0.0
System.IAsyncResult
To be added.
To be added.
To be added.
Starting with the net_v45, you can perform asynchronous write operations by using the method. The method is still available in the net_v45 to support legacy code; however, you can implement asynchronous I/O operations more easily by using the new async methods. For more information, see Asynchronous File I/O.
Pass the object returned by the current method to to ensure that the write completes and frees resources appropriately. You can do this either by using the same code that called or in a callback passed to . If an error occurs during an asynchronous write operation, an exception will not be thrown until is called with the returned by this method.
If a stream is writable, writing at the end of the stream expands the stream.
The current position in the stream is updated when you issue the asynchronous read or write operation, not when the I/O operation completes. Multiple simultaneous asynchronous requests render the request completion order uncertain.
Use the property to determine whether the current object supports writing.
If a stream is closed or you pass an invalid argument, exceptions are thrown immediately from . Errors that occur during an asynchronous write request, such as a disk failure during the I/O request, occur on the thread pool thread and throw exceptions when calling .
Begins an asynchronous write operation. (Consider using the method instead; see the Remarks section.)
An object that represents the asynchronous write operation, which could still be pending.
The byte offset in to begin writing from.
The maximum number of bytes to write.
Property
2.0.0.0
4.0.0.0
System.Boolean
To be added.
To be added.
Gets a value indicating whether the stream supports reading while decompressing a file.
Property
2.0.0.0
4.0.0.0
System.Boolean
To be added.
To be added.
Gets a value indicating whether the stream supports seeking.
Property
2.0.0.0
4.0.0.0
System.Boolean
To be added.
To be added.
Gets a value indicating whether the stream supports writing.
Method
2.0.0.0
4.0.0.0
System.Void
This method is called by the public method and the method. invokes the protected method with the parameter set to true. invokes with set to false.
When the parameter is true, this method releases all resources held by any managed objects that this references. This method invokes the method of each referenced object.
Releases the unmanaged resources used by the and optionally releases the managed resources.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Method
2.0.0.0
4.0.0.0
System.Int32
To be added.
Starting with the net_v45, you can perform asynchronous read operations by using the method. The method is still available in the net_v45 to support legacy code; however, you can implement asynchronous I/O operations more easily by using the new async methods. For more information, see Asynchronous File I/O.
Call this method to determine how many bytes were read from the stream. This method can be called once to return the amount of bytes read between calls to and .
This method blocks until the I/O operation has completed.
Waits for the pending asynchronous read to complete. (Consider using the method instead; see the Remarks section.)
The number of bytes read from the stream, between 0 (zero) and the number of bytes you requested. returns 0 only at the end of the stream; otherwise, it blocks until at least one byte is available.
Method
2.0.0.0
4.0.0.0
System.Void
To be added.
Starting with the net_v45, you can perform asynchronous write operations by using the method. The method is still available in the net_v45 to support legacy code; however, you can implement asynchronous I/O operations more easily by using the new async methods. For more information, see Asynchronous File I/O.
must be called only once for every call to the method.
This method blocks until the I/O operation has completed. Errors that occur during an asynchronous write request, such as a disk failure during the I/O request, occur on the thread pool thread and become visible upon a call to . Exceptions thrown by the thread pool thread will not be visible when calling .
Ends an asynchronous write operation. (Consider using the method instead; see the Remarks section.)
Method
2.0.0.0
4.0.0.0
System.Void
The current implementation of this method does not flush the internal buffer. The internal buffer is flushed when the object is disposed.
The current implementation of this method has no functionality.
Property
2.0.0.0
4.0.0.0
System.Int64
To be added.
To be added.
This property is not supported and always throws a .
Property
2.0.0.0
4.0.0.0
System.Int64
To be added.
To be added.
This property is not supported and always throws a .
Method
2.0.0.0
4.0.0.0
System.Int32
To be added.
To be added.
To be added.
Reads a number of decompressed bytes into the specified byte array.
The number of bytes that were read into the byte array.
The maximum number of decompressed bytes to read.
Method
2.0.0.0
4.0.0.0
System.Int64
To be added.
This operation is not supported and always throws a .
A long value.
The location in the stream.
One of the values.
Method
2.0.0.0
4.0.0.0
System.Void
To be added.
This operation is not supported and always throws a .
The length of the stream.
Method
2.0.0.0
4.0.0.0
System.Void
To be added.
To be added.
To be added.
Writes compressed bytes to the underlying stream from the specified byte array.
The maximum number of bytes to write.