本人从网站上抓取下来的是数据是,是经过压缩处理的,"gzip, deflate", 本人借用ICSharpCode.SharpZipLib进行解压缩,但都没成功,
Stream stream2 = File.OpenRead(this.ZipFileName);
GZipInputStream stream1 = new GZipInputStream(stream2);
StreamReader reader1 = new StreamReader(stream1, this.Encoding);
this.Result = reader1.ReadToEnd();\\在此报错
stream2.Close();
stream1.Close();而且借用C1.C1ZIP,也不成功!
有没有这方面的比较有经验的兄弟,帮帮忙!来解决一下,我这有两个文件可以发给你试一下,本人QQ151201379沧海一声笑;
不知我调用的ICSharpCode是不是有问题,先贴出部分大家看;
public class GZipInputStream : InflaterInputStream
{
public GZipInputStream(Stream baseInputStream) : this(baseInputStream, 0x1000)
{
} public GZipInputStream(Stream baseInputStream, int size) : base(baseInputStream, new ICSharpCode.SharpZipLib.Zip.Compression.Inflater(true), size)
{
this.crc = new Crc32();
} public override int Read(byte[] buf, int offset, int len)
{
if (!this.readGZIPHeader)
{
this.ReadHeader();
}
if (this.eos)
{
Stream stream2 = File.OpenRead(this.ZipFileName);
GZipInputStream stream1 = new GZipInputStream(stream2);
StreamReader reader1 = new StreamReader(stream1, this.Encoding);
this.Result = reader1.ReadToEnd();\\在此报错
stream2.Close();
stream1.Close();而且借用C1.C1ZIP,也不成功!
有没有这方面的比较有经验的兄弟,帮帮忙!来解决一下,我这有两个文件可以发给你试一下,本人QQ151201379沧海一声笑;
不知我调用的ICSharpCode是不是有问题,先贴出部分大家看;
public class GZipInputStream : InflaterInputStream
{
public GZipInputStream(Stream baseInputStream) : this(baseInputStream, 0x1000)
{
} public GZipInputStream(Stream baseInputStream, int size) : base(baseInputStream, new ICSharpCode.SharpZipLib.Zip.Compression.Inflater(true), size)
{
this.crc = new Crc32();
} public override int Read(byte[] buf, int offset, int len)
{
if (!this.readGZIPHeader)
{
this.ReadHeader();
}
if (this.eos)
{
http://www.codeproject.com/cs/files/sharpzlib.asp
http://www.icsharpcode.net/OpenSource/SharpZipLib/
有的文件直接用WINRAR程序都报错,是不是肯定用程序也解不开了?