Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

GZipArchive

OfficeIMO.Archives

Namespace
OfficeIMO.Archives
Assembly
OfficeIMO.Archives
Source revision
ac7e6e1bad8a with working tree changes
Modifiers
static

Reads and writes gzip (RFC 1952) streams. Writing uses the same deterministic Deflate encoder as the ZIP writer; reading verifies every member's CRC-32 and length and accepts concatenated members.

Inheritance

  • object
  • GZipArchive

Methods

public static void Compress(Stream source, Stream destination, GZipWriterOptions? options = null, CancellationToken cancellationToken = default) #

Compresses the source from its current position to its end as one gzip member. Both streams stay open.

Parameters

source System.IO.Stream required
destination System.IO.Stream required
options OfficeIMO.Archives.GZipWriterOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public static Stream CreateWriter(Stream destination, GZipWriterOptions? options = null, bool leaveOpen = false) #

Returns a stream that compresses everything written to it as one gzip member. Disposing it writes the trailer.

Parameters

destination System.IO.Stream required
options OfficeIMO.Archives.GZipWriterOptions? = null optional
leaveOpen bool = false optional

Returns

Stream
public static GZipReadResult Decompress(Stream source, Stream destination, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #

Decompresses every member of a gzip stream into the destination, verifying checksums and lengths. Input is bounded by ArchiveReadOptions.MaxInputBytes; output by the smaller of ArchiveReadOptions.MaxEntryBytes and ArchiveReadOptions.MaxExpandedBytes, and it is charged to the operation budget as selected bytes. Nonseekable input is snapshotted first. The source stays open.

Parameters

source System.IO.Stream required
destination System.IO.Stream required
options OfficeIMO.Archives.ArchiveReadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Exceptions

  • InvalidDataException – The input is not gzip, is truncated, or fails a checksum.
  • OfficeInspectionResourceLimitException – A configured limit is exceeded.