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


C# GZipInputStream.ReadByte方法代码示例

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


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

示例1: ZeroLengthInputStream

        public void ZeroLengthInputStream()
        {
            var gzi = new GZipInputStream(new MemoryStream());
            bool exception = false;
            int retval = int.MinValue;
            try
            {
                retval = gzi.ReadByte();
            }
            catch
            {
                exception = true;
            }

            Assert.IsFalse(exception, "reading from an empty stream should not cause an exception");
            Assert.That(retval, Is.EqualTo(-1), "should yield -1 byte value");
        }
开发者ID:icsharpcode,项目名称:SharpZipLib,代码行数:17,代码来源:GZipTests.cs

示例2: DoOpen

		override protected void DoOpen (FileInfo info)
		{
			// Try to open the file as if it is gzip.
			// If that fails, we conclude that it must
			// just be a regular text file full of xml.
			is_gzipped = true;
			try {
				Stream s;
				s = new FileStream (info.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
				Stream z;
				z = new GZipInputStream (s);
				z.ReadByte ();
				z.Close ();
				s.Close ();
			} catch (Exception) {
				is_gzipped = false;
			}

			hotStyles = new Hashtable ();
			reader = BuildReader (info.FullName);
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:21,代码来源:FilterAbiword.cs

示例3: ZeroLengthInputStream

        public void ZeroLengthInputStream()
        {
            GZipInputStream gzi = new GZipInputStream(new MemoryStream());
            bool exception = false;
            try {
                gzi.ReadByte();
            }
            catch {
                exception = true;
            }

            Assert.IsTrue(exception, "reading from an empty stream should cause an exception");
        }
开发者ID:jeske,项目名称:StepsDB-alpha,代码行数:13,代码来源:GZipTests.cs

示例4: ReadByteWithZeroLengthInputStreamShouldReturnEndOfStream

        public void ReadByteWithZeroLengthInputStreamShouldReturnEndOfStream()
        {
            using (var gzi = new GZipInputStream(new MemoryStream()))
            {

                int val = gzi.ReadByte();

                Assert.AreEqual(-1,val);
            }
        }
开发者ID:firestrand,项目名称:SharpZipLib,代码行数:10,代码来源:GZipTests.cs


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