GzipCompressedContent Class

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

Definition

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

Constructors

GzipCompressedContent(HttpContent, CompressionLevel)

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

Parameters

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

Exceptions

ArgumentNullException
Thrown when content is null.

Methods

CompressStream(Stream)

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

Parameters

stream Stream
The stream that receives the compressed data.

Returns

Stream
A GZipStream 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.