当前位置: 首页>>代码示例>>C#>>正文


C# InflaterInputStream.Flush方法代码示例

本文整理汇总了C#中ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# InflaterInputStream.Flush方法的具体用法?C# InflaterInputStream.Flush怎么用?C# InflaterInputStream.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream的用法示例。


在下文中一共展示了InflaterInputStream.Flush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeCompress

 public static byte[] DeCompress( byte []b )
 {
     Stream s2 = new InflaterInputStream( new MemoryStream( b ) );
     try
     {
         byte []dest = null;
         int size = s2.Read( writeData, 0, writeData.Length);
         if (size > 0)
         {
             dest = new byte[ size ];
             Buffer.BlockCopy( writeData , 0, dest, 0, size );
         }
         s2.Flush();
         s2.Close();
         return dest;
     }
     catch(Exception e)
     {
         Console.WriteLine( e.Message );
         return null;
     }
 }
开发者ID:karliky,项目名称:wowwow,代码行数:22,代码来源:Zip.cs

示例2: DecompressZlib

 public static byte[] DecompressZlib(byte[] input, int size)
 {
     byte[] result = new byte[size];
     InflaterInputStream zipStream = new InflaterInputStream(new MemoryStream(input));
     zipStream.Read(result, 0, size);
     zipStream.Flush();
     return result;
 }
开发者ID:tirnoney,项目名称:DAIToolsWV,代码行数:8,代码来源:Helpers.cs

示例3: Decompress

        public static byte[] Decompress(byte[] buffer, int offset, int count)
        {
            if (buffer == null)
                throw new ArgumentNullException();
            if (count < 0)
                throw new FormatException();
            if (offset + count > buffer.Length)
                throw new IndexOutOfRangeException();

            using (MemoryStream buffStream = new MemoryStream(buffer, offset, count))
            {
                InflaterInputStream zipStream;
                uint magicStream = buffStream.ReadValueU32();
                if (magicStream != magic && magicStream.Swap() != magic)
                {
                    throw new InvalidDataException("found an invalid zlib block");
                }

                uint buffMaxSegmentSize = buffStream.ReadValueU32();
                if (buffMaxSegmentSize != maxSegmentSize)
                {
                    throw new FormatException();
                }

                uint totComprSize = buffStream.ReadValueU32();
                uint totUncomprSize = buffStream.ReadValueU32();

                byte[] outputBuffer = new byte[totUncomprSize];
                int numOfSegm = (int)Math.Ceiling((double)totUncomprSize / (double)maxSegmentSize);
                int headSegm = 16;
                int dataSegm = headSegm + (numOfSegm * 8);
                int buffOff = 0;

                for (int i = 0; i < numOfSegm; i++)
                {
                    buffStream.Seek(headSegm, SeekOrigin.Begin);
                    int comprSegm = buffStream.ReadValueS32();
                    int uncomprSegm = buffStream.ReadValueS32();
                    headSegm = (int)buffStream.Position;

                    buffStream.Seek(dataSegm, SeekOrigin.Begin);
                    //Console.WriteLine("compr size: {0}, uncompr size: {1}, data offset: 0x{2:X8}", comprSegm, uncomprSegm, dataSegm);
                    zipStream = new InflaterInputStream(buffStream);
                    zipStream.Read(outputBuffer, buffOff, uncomprSegm);
                    zipStream.Flush();
                    buffOff += uncomprSegm;
                    dataSegm += comprSegm;
                }
                buffStream.Close();
                return outputBuffer;
            }
        }
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:52,代码来源:ZlibBlock.cs

示例4: UncompressBlock

 private byte[] UncompressBlock(Stream s, uint CompSize, uint UnCompSize)
 {
     byte[] res = new byte[UnCompSize];
     try
     {
         InflaterInputStream zipstream = new InflaterInputStream(s);
         zipstream.Read(res, 0, (int)UnCompSize);
         zipstream.Flush();         
     }
     catch (Exception ex)
     {
         DebugLog.PrintLn("PCCPACKAGE::UNCOMPRESSBLOCK ERROR:\n" + ex.Message);                
     }
     return res;
 }
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:15,代码来源:PCCPackage.cs


注:本文中的ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。