# Lz4Archive

Reads and writes LZ4 frame streams in managed code.

Class 

`OfficeIMO.Archives`

**Namespace**

`OfficeIMO.Archives`

**Assembly**

`OfficeIMO.Archives`

**Source revision**

`12511d2fa560` with working tree changes

**Source**

[Lz4Archive.cs:35](https://github.com/EvotecIT/OfficeIMO/blob/12511d2fa560784a40564a2dc62102d2005ed547/OfficeIMO.Archives/Lz4Archive.cs#L35)

**Modifiers**

static

Reads and writes LZ4 frame streams in managed code.

## Inheritance

- object
- Lz4Archive

Filter members 

Show inherited

## Methods

`public static void Compress(Stream source, Stream destination, CancellationToken cancellationToken = default)` [#](#method-compress-io-stream-io-stream-threading-cancellationtoken)

[Lz4Archive.Writer.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/12511d2fa560784a40564a2dc62102d2005ed547/OfficeIMO.Archives/Lz4Archive.Writer.cs#L18)

Compresses the source from its current position through EOF as one deterministic LZ4 frame. Both streams stay open. Cancellation or I/O failure can leave an incomplete frame in the destination.

Parameters

**source System.IO.Stream required**

**destination System.IO.Stream required**

**cancellationToken System.Threading.CancellationToken = default optional**

`public static Stream CreateWriter(Stream destination, bool leaveOpen = false)` [#](#method-createwriter-io-stream-boolean)

[Lz4Archive.Writer.cs:10](https://github.com/EvotecIT/OfficeIMO/blob/12511d2fa560784a40564a2dc62102d2005ed547/OfficeIMO.Archives/Lz4Archive.Writer.cs#L10)

Returns a stream that writes one deterministic LZ4 frame with independent 64 KiB blocks and block and content checksums. Dispose the writer to finish the frame.

Parameters

**destination System.IO.Stream required**

**leaveOpen bool = false optional**

Returns

`Stream`

`public static Lz4ReadResult Decompress(Stream source, Stream destination, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-decompress-io-stream-io-stream-officeimo-archives-archivereadoptions-threading-cancellationtoken)

[Lz4Archive.cs:35](https://github.com/EvotecIT/OfficeIMO/blob/12511d2fa560784a40564a2dc62102d2005ed547/OfficeIMO.Archives/Lz4Archive.cs#L35)

Decompresses concatenated LZ4 frames, including independent and linked blocks, into the destination. Optional block and content checksums and declared content sizes are verified.

Parameters

**source System.IO.Stream required**

**destination System.IO.Stream required**

**options OfficeIMO.Archives.ArchiveReadOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Lz4ReadResult`

Exceptions

- `ArchiveCorruptionException` – The input is not a complete valid LZ4 stream.
- `NotSupportedException` – The frame declares a preset dictionary or unsupported version.
- `OfficeInspectionResourceLimitException` – A configured limit is exceeded.

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:F8A1363F915E891D20381839C936E3B28E4D40B504AC4A920A1FB4EC36E6698D -->
