Click or drag to resize

CompressionExtensionsCompress(Stream, CompressionStrength) Method

Compress a stream using specified compression strength.

Namespace: GSF.IO.Compression
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public static MemoryStream Compress(
	this Stream source,
	CompressionStrength strength
)
View Source

Parameters

source  Stream
The Stream to compress.
strength  CompressionStrength
The CompressionStrength of the compression.

Return Value

MemoryStream
Returns a MemoryStream of the compressed Stream.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Stream. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This returns a memory stream of the compressed results, if the incoming stream is very large this will consume a large amount memory. In this case use the overload that takes the destination stream as a parameter instead.
See Also