123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #if !NETCF_2_0 && !NET_1_1
- using System;
- using System.IO;
- namespace CommonMPQ.SharpZipLib.BZip2 {
-
-
-
-
- public static class BZip2
- {
-
-
-
-
-
-
-
- public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner)
- {
- if (inStream == null || outStream == null) {
- throw new Exception("Null Stream");
- }
-
- try {
- using (BZip2InputStream bzipInput = new BZip2InputStream(inStream)) {
- bzipInput.IsStreamOwner = isStreamOwner;
- Core.StreamUtils.Copy(bzipInput, outStream, new byte[4096]);
- }
- } finally {
- if (isStreamOwner) {
-
- outStream.Close();
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
- public static void Compress(Stream inStream, Stream outStream, bool isStreamOwner, int level)
- {
- if (inStream == null || outStream == null) {
- throw new Exception("Null Stream");
- }
- try {
- using (BZip2OutputStream bzipOutput = new BZip2OutputStream(outStream, level)) {
- bzipOutput.IsStreamOwner = isStreamOwner;
- Core.StreamUtils.Copy(inStream, bzipOutput, new byte[4096]);
- }
- } finally {
- if (isStreamOwner) {
-
- inStream.Close();
- }
- }
- }
- }
- }
- #endif
|