下面内容内容是关于C#解压GZip文件的内容,应该对小伙伴们有所用。
public void ungzip(string path, string decomPath, bool overwrite)
{
if (File.Exists(decomPath))
{
if (overwrite)
{
File.Delete(decomPath);
}
else
{
throw new IOException("The decompressed path you specified already exists and cannot be overwritten.");
}
}
GZipStream stream = new GZipStream(new FileStream(path, FileMode.Open, FileAccess.ReadWrite), CompressionMode.Decompress);
FileStream decompressedFile = new FileStream(decomPath, FileMode.OpenOrCreate, FileAccess.Write);
int data;
{
decompressedFile.WriteByte((byte)data);
}
decompressedFile.Close();
stream.Close();
}
网友评论