RegisterCompressionStreamCreator Method (compressionMethod, compressionMode, creator)

Microsoft Deployment Compression & Installer

Copy image CopyHover image
Deployment Tools Foundation RegisterCompressionStreamCreator Method (compressionMethod, compressionMode, creator)
Deployment Tools Foundation NamespacesMicrosoft.Deployment.Compression.ZipZipEngineRegisterCompressionStreamCreator(ZipCompressionMethod, CompressionMode, Converter<(Of <<'(Stream, Stream>)>>))
Registers a delegate that can create a warpper stream for compressing or uncompressing the data of a source stream.
Declaration Syntax
C# Visual Basic Visual C++
public static void RegisterCompressionStreamCreator(
	ZipCompressionMethod compressionMethod,
	CompressionMode compressionMode,
	Converter<Stream, Stream> creator
)
Public Shared Sub RegisterCompressionStreamCreator ( 
	compressionMethod As ZipCompressionMethod,
	compressionMode As CompressionMode,
	creator As Converter(Of Stream, Stream)
)
public:
static void RegisterCompressionStreamCreator(
	ZipCompressionMethod compressionMethod, 
	CompressionMode compressionMode, 
	Converter<Stream^, Stream^>^ creator
)
Parameters
compressionMethod (ZipCompressionMethod)
Compression method being registered.
compressionMode (CompressionMode)
Indicates registration for ether compress or decompress mode.
creator (Converter<(Of <(<'Stream, Stream>)>)>)
Delegate being registered.
Remarks
For compression, the delegate accepts a stream that writes to the archive and returns a wrapper stream that compresses bytes as they are written. For decompression, the delegate accepts a stream that reads from the archive and returns a wrapper stream that decompresses bytes as they are read. This wrapper stream model follows the design used by System.IO.Compression.DeflateStream, and indeed that class is used to implement the Deflate compression method by default.

To unregister a delegate, call this method again and pass null for the delegate parameter.

Examples
When the ZipEngine class is initialized, the Deflate compression method is automatically registered like this:
 Copy imageCopy
ZipEngine.RegisterCompressionStreamCreator(
    ZipCompressionMethod.Deflate,
    CompressionMode.Compress,
    delegate(Stream stream) {
        return new DeflateStream(stream, CompressionMode.Compress, true);
    });
ZipEngine.RegisterCompressionStreamCreator(
    ZipCompressionMethod.Deflate,
    CompressionMode.Decompress,
    delegate(Stream stream) {
        return new DeflateStream(stream, CompressionMode.Decompress, true);
    });

Assembly: Microsoft.Deployment.Compression.Zip (Module: Microsoft.Deployment.Compression.Zip.dll) Version: 3.0.0.0 (3.9.1006.0)