本文整理汇总了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");
}
示例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);
}
示例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");
}
示例4: ReadByteWithZeroLengthInputStreamShouldReturnEndOfStream
public void ReadByteWithZeroLengthInputStreamShouldReturnEndOfStream()
{
using (var gzi = new GZipInputStream(new MemoryStream()))
{
int val = gzi.ReadByte();
Assert.AreEqual(-1,val);
}
}