DeflateCompressedContent Class

Namespace
Kampute.HttpClient.Content.Compression
Assembly
  • Kampute.HttpClient.dll

Definition

Represents content that compresses another HttpContent with Deflate as it is sent.
public sealed class DeflateCompressedContent : CompressedContent
Inheritance

Constructors

DeflateCompressedContent(HttpContent, CompressionLevel)

Initializes a new instance of the DeflateCompressedContent class.
public DeflateCompressedContent(HttpContent content, CompressionLevel compressionLevel = CompressionLevel.Fastest)

Parameters

content HttpContent
The content to compress. It is disposed when this instance is disposed.
compressionLevel CompressionLevel optional
Whether to favor speed or size. The default is CompressionLevel.Fastest.

Exceptions

ArgumentNullException
Thrown when content is null.

Methods

CompressStream(Stream)

Returns a stream that compresses the data written to it with Deflate into the specified stream.
protected override Stream CompressStream(Stream stream)

Parameters

stream Stream
The stream that receives the compressed data.

Returns

Stream
A DeflateStream that writes to stream.

Extension Methods

AsDeflate(this HttpContent, CompressionLevel)Wraps the content in content that compresses it with Deflate as it is sent.
AsGzip(this HttpContent, CompressionLevel)Wraps the content in content that compresses it with GZip as it is sent.
FindCharacterEncoding(this HttpContent)Returns the character encoding named by the charset parameter of the Content-Type header.
IsReusable(this HttpContent)Determines whether the content can be sent more than once, as a retry requires.