Esempio n. 1
0
 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 stream = new BZip2OutputStream(outStream, level))
         {
             stream.IsStreamOwner = isStreamOwner;
             StreamUtils.Copy(inStream, stream, new byte[0x1000]);
         }
     }
     finally
     {
         if (isStreamOwner)
         {
             inStream.Close();
         }
     }
 }