本文整理汇总了C#中ICSharpCode.SharpZipLib.Zip.ZipInputStream.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# ZipInputStream.Flush方法的具体用法?C# ZipInputStream.Flush怎么用?C# ZipInputStream.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.SharpZipLib.Zip.ZipInputStream
的用法示例。
在下文中一共展示了ZipInputStream.Flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecompressByteZip
/// <summary>
/// 解压
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
static public void DecompressByteZip(byte[] inBytes, uint startPos, uint inLen, ref byte[] outBytes, ref uint outLen)
{
byte[] writeData = new byte[4096];
MemoryStream outStream = new MemoryStream();
MemoryStream ms = new MemoryStream();
ms.Write(inBytes, 0, (int)inLen);
ms.Position = 0;
ZipInputStream zipStream = new ZipInputStream(ms);
zipStream.GetNextEntry();
try
{
int size = 0;
while ((size = zipStream.Read(writeData, 0, writeData.Length)) > 0)
{
outStream.Write(writeData, 0, size);
}
zipStream.Flush();
zipStream.Close(); // 一定要先 Close ZipOutputStream ,然后再获取 ToArray ,如果不关闭, ToArray 将不能返回正确的值
outBytes = outStream.ToArray();
outLen = (uint)outBytes.Length;
outStream.Close();
}
finally
{
zipStream.Close();
ms.Close();
outStream.Close();
}
}