This project contains the following classes:
Note that since this is a mixed mode .DLL implementation, the client application must call, ManagedZLib.ManagedZLib.Initialize() before using the compression classes, and call ManagedZLib.ManagedZLib.Terminate() to release the .DLL's resources. See the following for more information:
ManagedZLib.CompressionStream : System.IO.Stream
This class wraps the ZLib deflate and inflate functions in a .NET System.Stream object.
CompressionStream( Stream stream, CompressionOptions option )
Creates an instance of the compression stream object.
stream - The underlying stream that will be used to either read compressed data from or write compressed data to.
option - Specify the option to use when opening the compression stream object. The following options are available:
static string ZLibVersion
Returns the version of ZLib being used for the compression ("1.2.2").
static CompressionOptions GetLevel( int level )
Translates a numeric level (0-9) into one of the CompressionOptions enumerated values. Invalid values are just translated in the default compression level.
The following properties are used to obtain information about the compression or decompression. Each of these properties are available after the stream has been closed.
unsigned int CRC
Returns the CRC of the uncompressed data.
unsigned long BytesIn
When compressing data, returns the number of uncompressed bytes written to this stream object. When decompressing data, returns the number of compressed bytes read from the source stream.
unsigned long BytesOut
When compressing data, returns the number of compressed bytes written to the destination stream. When decompressing data, returns the number of uncompressed bytes read from this stream object.
double CompressionRatio
Returns the percent compression of the data.
Two thin wrapper classes are also available, Compress (derived from BinaryWriter) and Decompress (derived from BinaryReader). These classes are used exactly like the concrete BinaryWriter and BinaryReader classes, except that a CompressionStream object is inserted between the class and the stream object you provide. Also these classes publish the same CRC, BytesIn, BytesOut, and CompressionRatio properties as the CompressionStream object.
ManagedZLib.Base64Stream : System.IO.Stream
This class wraps the Base-64 encoding and decoding functions in a .NET System.Stream object.
Base64Stream( Stream stream, Base64Options option )
Creates an instance of the Base-64 stream object.
stream - The underlying stream that will be used to either read decoded data from or write encoded data to.
option - Specify the option to use when opening the compression stream object. The following options are available: