# BZip2Archive

Reads and writes bzip2 streams in managed code.

Class 

`OfficeIMO.Archives`

**Namespace**

`OfficeIMO.Archives`

**Assembly**

`OfficeIMO.Archives`

**Source revision**

`12511d2fa560` with working tree changes

**Source**

[BZip2Archive.cs:14](https://github.com/EvotecIT/OfficeIMO/blob/12511d2fa560784a40564a2dc62102d2005ed547/OfficeIMO.Archives/BZip2Archive.cs#L14)

**Modifiers**

static

Reads and writes bzip2 streams in managed code.

## Inheritance

- object
- BZip2Archive

Filter members 

Show inherited

## Methods

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

[BZip2Archive.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/12511d2fa560784a40564a2dc62102d2005ed547/OfficeIMO.Archives/BZip2Archive.cs#L28)

Compresses the source from its current position through EOF as one deterministic bzip2 member. Both streams remain open. Cancellation or an I/O failure can leave incomplete output.

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)

[BZip2Archive.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/12511d2fa560784a40564a2dc62102d2005ed547/OfficeIMO.Archives/BZip2Archive.cs#L23)

Creates a deterministic bzip2 stream writer. Dispose it to finish the member.

Parameters

**destination System.IO.Stream required**

**leaveOpen bool = false optional**

Returns

`Stream`

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

[BZip2Archive.cs:14](https://github.com/EvotecIT/OfficeIMO/blob/12511d2fa560784a40564a2dc62102d2005ed547/OfficeIMO.Archives/BZip2Archive.cs#L14)

Decompresses complete concatenated bzip2 members and checks their block and stream checksums. Returns the number of decoded bytes. Both streams remain open.

Parameters

**source System.IO.Stream required**

**destination System.IO.Stream required**

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

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

Returns

`long`

## 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:2F82E513D15397EC7FF4859707FB024A30043EC4A95B870D8AB078772A0D263E -->
