# ICSharpCode.SharpZipLib.BZip2.BZip2 - Coverage Report

# Summary

Class: | ICSharpCode.SharpZipLib.BZip2.BZip2
Assembly: | ICSharpCode.SharpZipLib
File(s): | C:\Users\Neil\Documents\Visual Studio 2015\Projects\icsharpcode\SZL_master\ICSharpCode.SharpZipLib\BZip2\BZip2.cs
Covered lines: | 0
Uncovered lines: | 20
Coverable lines: | 20
Total lines: | 66
Line coverage: | 0%
Branch coverage: | 0%

# Metrics

Method | Cyclomatic Complexity | Sequence Coverage | Branch Coverage
--- | --- | --- | ---
Decompress(...) | 5 | 0 | 0
Compress(...) | 5 | 0 | 0

# File(s)

## C:\Users\Neil\Documents\Visual Studio 2015\Projects\icsharpcode\SZL_master\ICSharpCode.SharpZipLib\BZip2\BZip2.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using System.IO;`
|  | `3` |  | ``
|  | `4` |  | `namespace ICSharpCode.SharpZipLib.BZip2`
|  | `5` |  | `{`
|  | `6` |  | `/// <summary>`
|  | `7` |  | `/// An example class to demonstrate compression and decompression of BZip2 streams.`
|  | `8` |  | `/// </summary>`
|  | `9` |  | `public static class BZip2`
|  | `10` |  | `{`
|  | `11` |  | `/// <summary>`
|  | `12` |  | `/// Decompress the <paramref name="inStream">input</paramref> writing`
|  | `13` |  | `/// uncompressed data to the <paramref name="outStream">output stream</paramref>`
|  | `14` |  | `/// </summary>`
|  | `15` |  | `/// <param name="inStream">The readable stream containing data to decompress.</param>`
|  | `16` |  | `/// <param name="outStream">The output stream to receive the decompressed data.</param>`
|  | `17` |  | `/// <param name="isStreamOwner">Both streams are closed on completion if true.</param>`
|  | `18` |  | `public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner)`
|  | `19` |  | `{`
| 0 | `20` |  | `if (inStream == null || outStream == null) {`
| 0 | `21` |  | `throw new Exception("Null Stream");`
|  | `22` |  | `}`
|  | `23` |  | ``
|  | `24` |  | `try {`
| 0 | `25` |  | `using (BZip2InputStream bzipInput = new BZip2InputStream(inStream)) {`
| 0 | `26` |  | `bzipInput.IsStreamOwner = isStreamOwner;`
| 0 | `27` |  | `Core.StreamUtils.Copy(bzipInput, outStream, new byte[4096]);`
| 0 | `28` |  | `}`
|  | `29` |  | `} finally {`
| 0 | `30` |  | `if (isStreamOwner) {`
|  | `31` |  | `// inStream is closed by the BZip2InputStream if stream owner`
| 0 | `32` |  | `outStream.Close();`
|  | `33` |  | `}`
| 0 | `34` |  | `}`
| 0 | `35` |  | `}`
|  | `36` |  | ``
|  | `37` |  | `/// <summary>`
|  | `38` |  | `/// Compress the <paramref name="inStream">input stream</paramref> sending`
|  | `39` |  | `/// result data to <paramref name="outStream">output stream</paramref>`
|  | `40` |  | `/// </summary>`
|  | `41` |  | `/// <param name="inStream">The readable stream to compress.</param>`
|  | `42` |  | `/// <param name="outStream">The output stream to receive the compressed data.</param>`
|  | `43` |  | `/// <param name="isStreamOwner">Both streams are closed on completion if true.</param>`
|  | `44` |  | `/// <param name="level">Block size acts as compression level (1 to 9) with 1 giving`
|  | `45` |  | `/// the lowest compression and 9 the highest.</param>`
|  | `46` |  | `public static void Compress(Stream inStream, Stream outStream, bool isStreamOwner, int level)`
|  | `47` |  | `{`
| 0 | `48` |  | `if (inStream == null || outStream == null) {`
| 0 | `49` |  | `throw new Exception("Null Stream");`
|  | `50` |  | `}`
|  | `51` |  | ``
|  | `52` |  | `try {`
| 0 | `53` |  | `using (BZip2OutputStream bzipOutput = new BZip2OutputStream(outStream, level)) {`
| 0 | `54` |  | `bzipOutput.IsStreamOwner = isStreamOwner;`
| 0 | `55` |  | `Core.StreamUtils.Copy(inStream, bzipOutput, new byte[4096]);`
| 0 | `56` |  | `}`
|  | `57` |  | `} finally {`
| 0 | `58` |  | `if (isStreamOwner) {`
|  | `59` |  | `// outStream is closed by the BZip2OutputStream if stream owner`
| 0 | `60` |  | `inStream.Close();`
|  | `61` |  | `}`
| 0 | `62` |  | `}`
| 0 | `63` |  | `}`
|  | `64` |  | ``
|  | `65` |  | `}`
|  | `66` |  | `}`