国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

C#實現解壓GZip文件的方法

2020-01-24 01:51:37
字體:
來源:轉載
供稿:網友

本文實例講述了C#實現解壓GZip文件的方法。分享給大家供大家參考。具體實現方法如下:

public void ungzip(string path, string decomPath, bool overwrite){  //for overwriting purposes  if (File.Exists(decomPath))  { if (overwrite) {   File.Delete(decomPath); } else {   throw new IOException("The decompressed path you specified already exists and cannot be overwritten."); }  }  //create our file streams  GZipStream stream = new GZipStream(new FileStream(path, FileMode.Open, FileAccess.ReadWrite), CompressionMode.Decompress);  FileStream decompressedFile = new FileStream(decomPath, FileMode.OpenOrCreate, FileAccess.Write);  //data represents a byte from the compressed file  //it's set through each iteration of the while loop  int data;  while ((data = stream.ReadByte()) != -1) //iterates over the data of the compressed file and writes the decompressed data  { decompressedFile.WriteByte((byte)data);  }  //close our file streams   decompressedFile.Close();  stream.Close();}

希望本文所述對大家的C#程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 都安| 嘉黎县| 四川省| 余江县| 苏尼特右旗| 贺州市| 武乡县| 正安县| 巩义市| 灌南县| 新沂市| 阿图什市| 赤城县| 盐津县| 高州市| 视频| 天峨县| 枞阳县| 永清县| 尉氏县| 长葛市| 丹阳市| 翁牛特旗| 华容县| 志丹县| 左贡县| 华宁县| 遂川县| 江都市| 陇南市| 锡林浩特市| 尚志市| 砀山县| 河北区| 美姑县| 射阳县| 松原市| 贵阳市| 洪泽县| 裕民县| 保康县|