美文网首页
C#解压GZip文件源码

C#解压GZip文件源码

作者: 简简单单咦 | 来源:发表于2018-12-13 14:54 被阅读0次

下面内容内容是关于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();

        }

相关文章

  • C#解压GZip文件源码

    下面内容内容是关于C#解压GZip文件的内容,应该对小伙伴们有所用。 public void ungzip...

  • 4、Linux压缩命令

    压缩与解压缩命令 gzip 使用gzip程序压缩/解压缩文件,文件扩展名以 .gz 结尾 zcat 查看以gzip...

  • Linxu备份压缩命令

    gzip命令 命令格式:gzip [选项] 压缩(解压缩)的文件名-d将压缩文件解压(decompress)-l显...

  • Linux压缩与解压类指令

    gzip/gunzip指令 gzip用于压缩文件,gunzip用于解压。gzip指令压缩完文件之后,原文件不予以保...

  • 01-pySpark 安装

    Linux 下载spark问题 gzip: stdin: not in gzip format 下载地址 解压文件...

  • 6.Linux 压缩

    gzip/gunzip gzio用于压缩,gunzip用于解压 基本语法gzip 文件gunzip 文件.gz 实...

  • Linux_压缩与解压

    gzip gzip 是压缩文件,压缩之后文件后缀为.gzgzip 选项 [文件]gunzip 解压 tar 这个命...

  • Linux压缩和解压类指令

    1).gzip 和gunzip 指令 功能: gzip 用于压缩文件gunzip 用于解压文件 2). z...

  • 解压缩gz文件

    使用gzip命令解压缩gzw文件

  • gzip: stdin: not in gzip format

    在Linux环境下,通过tar -zxvf 命令解压文件时遇到”gzip: stdin: not in gzip ...

网友评论

      本文标题:C#解压GZip文件源码

      本文链接:https://www.haomeiwen.com/subject/gqfbhqtx.html