GZipArchive
OfficeIMO.Archives
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
- destination System.IO.Stream
- options OfficeIMO.Archives.GZipWriterOptions? = null
- cancellationToken System.Threading.CancellationToken = default
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
- options OfficeIMO.Archives.GZipWriterOptions? = null
- leaveOpen bool = false
Returns
Streampublic 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
- destination System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
GZipReadResultExceptions
InvalidDataException– The input is not gzip, is truncated, or fails a checksum.OfficeInspectionResourceLimitException– A configured limit is exceeded.