@@ -9,58 +9,69 @@ namespace ICSharpCode.SharpZipLib.BZip2
99 public static class BZip2
1010 {
1111 /// <summary>
12- /// Decompress the <paramref name="inStream">input</paramref> writing
12+ /// Decompress the <paramref name="inStream">input</paramref> writing
1313 /// uncompressed data to the <paramref name="outStream">output stream</paramref>
1414 /// </summary>
1515 /// <param name="inStream">The readable stream containing data to decompress.</param>
1616 /// <param name="outStream">The output stream to receive the decompressed data.</param>
1717 /// <param name="isStreamOwner">Both streams are closed on completion if true.</param>
1818 public static void Decompress ( Stream inStream , Stream outStream , bool isStreamOwner )
1919 {
20- if ( inStream == null || outStream == null ) {
20+ if ( inStream == null || outStream == null )
21+ {
2122 throw new Exception ( "Null Stream" ) ;
2223 }
2324
24- try {
25- using ( BZip2InputStream bzipInput = new BZip2InputStream ( inStream ) ) {
25+ try
26+ {
27+ using ( BZip2InputStream bzipInput = new BZip2InputStream ( inStream ) )
28+ {
2629 bzipInput . IsStreamOwner = isStreamOwner ;
2730 Core . StreamUtils . Copy ( bzipInput , outStream , new byte [ 4096 ] ) ;
2831 }
29- } finally {
30- if ( isStreamOwner ) {
32+ }
33+ finally
34+ {
35+ if ( isStreamOwner )
36+ {
3137 // inStream is closed by the BZip2InputStream if stream owner
3238 outStream . Dispose ( ) ;
3339 }
3440 }
3541 }
3642
3743 /// <summary>
38- /// Compress the <paramref name="inStream">input stream</paramref> sending
44+ /// Compress the <paramref name="inStream">input stream</paramref> sending
3945 /// result data to <paramref name="outStream">output stream</paramref>
4046 /// </summary>
4147 /// <param name="inStream">The readable stream to compress.</param>
4248 /// <param name="outStream">The output stream to receive the compressed data.</param>
4349 /// <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
50+ /// <param name="level">Block size acts as compression level (1 to 9) with 1 giving
4551 /// the lowest compression and 9 the highest.</param>
4652 public static void Compress ( Stream inStream , Stream outStream , bool isStreamOwner , int level )
4753 {
48- if ( inStream == null || outStream == null ) {
54+ if ( inStream == null || outStream == null )
55+ {
4956 throw new Exception ( "Null Stream" ) ;
5057 }
5158
52- try {
53- using ( BZip2OutputStream bzipOutput = new BZip2OutputStream ( outStream , level ) ) {
59+ try
60+ {
61+ using ( BZip2OutputStream bzipOutput = new BZip2OutputStream ( outStream , level ) )
62+ {
5463 bzipOutput . IsStreamOwner = isStreamOwner ;
5564 Core . StreamUtils . Copy ( inStream , bzipOutput , new byte [ 4096 ] ) ;
5665 }
57- } finally {
58- if ( isStreamOwner ) {
66+ }
67+ finally
68+ {
69+ if ( isStreamOwner )
70+ {
5971 // outStream is closed by the BZip2OutputStream if stream owner
6072 inStream . Dispose ( ) ;
6173 }
6274 }
6375 }
64-
6576 }
6677}
0 commit comments