Files
Dec2017-Script-Dump/ICSharpCode.SharpZipLib/BZip2/BZip2.cs
T
2026-06-04 11:42:34 +02:00

59 lines
1.3 KiB
C#

using System;
using System.IO;
using ICSharpCode.SharpZipLib.Core;
namespace ICSharpCode.SharpZipLib.BZip2
{
// Token: 0x02000002 RID: 2
public static class BZip2
{
// Token: 0x06000001 RID: 1 RVA: 0x000020D0 File Offset: 0x000010D0
public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner)
{
if (inStream == null || outStream == null)
{
throw new Exception("Null Stream");
}
try
{
using (BZip2InputStream bzip2InputStream = new BZip2InputStream(inStream))
{
bzip2InputStream.IsStreamOwner = isStreamOwner;
StreamUtils.Copy(bzip2InputStream, outStream, new byte[4096]);
}
}
finally
{
if (isStreamOwner)
{
outStream.Close();
}
}
}
// Token: 0x06000002 RID: 2 RVA: 0x00002144 File Offset: 0x00001144
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 bzip2OutputStream = new BZip2OutputStream(outStream, level))
{
bzip2OutputStream.IsStreamOwner = isStreamOwner;
StreamUtils.Copy(inStream, bzip2OutputStream, new byte[4096]);
}
}
finally
{
if (isStreamOwner)
{
inStream.Close();
}
}
}
}
}