//1.创建读取文本文件的流
using (FileStream fsRead = File.OpenRead(@"D:\YY.TXT"))
{
//2.创建写文件流
using (FileStream fsWrite = File.OpenWrite(@"D:\XX.rar"))
{
//3.创建压缩流
using (GZipStream zipStream = new GZipStream(fsWrite, CompressionMode.Compress))
{
byte[] byts = new byte[1024];
int len = 0;
//4.通过读取文件流读取数据
while ((len = fsRead.Read(byts, 0, byts.Length)) > 0)
{

//通过压缩流写入数据
zipStream.Write(byts, 0, len);

}
}
}
}

---------------------------

 

//1.创建读取流
using (FileStream fsRead = File.OpenRead(@"D:\XX.rar"))
{
//2.创建压缩流,把读取流作为参数,
using (GZipStream zip = new GZipStream(fsRead, CompressionMode.Decompress))
{
//创建写入流
using (FileStream fsWrite = File.OpenWrite(@"D:\ZZ.TXT"))
{
byte[] byts = new byte[1024];
int len = 0;//用于表示真是接受到是字节个数
//通过压缩流读取数据
while ((len = zip.Read(byts, 0, byts.Length)) > 0)
{
//MessageBox.Show(Encoding.UTF8.GetString(byts.Take(len).ToArray()));
//通过文件流写入文件
fsWrite.Write(byts, 0, len);//读取的长度为len,这样不会造成数据的错误
}
}
}
}

 

posted @ 2019-06-13 18:56 hi..... 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Visual Studio 2017 序列号 Key 激活码 VS2017 注册码 Visual Studio 2017(VS2017) 企业版 Enterprise 注册码 序列号:NJVYC-BMHX2-G77MM-4XJMR-6Q8QF Visual Studio 2017(VS2017) 专 阅读全文
posted @ 2017-12-21 10:33 hi..... 阅读(1682) 评论(0) 推荐(0) 编辑
摘要: Apache.NMS.ActiveMQ.dll Apache.NMS.dll 阅读全文
posted @ 2017-12-20 16:41 hi..... 阅读(207) 评论(0) 推荐(0) 编辑
摘要: package com.zjs.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servle... 阅读全文
posted @ 2017-12-18 17:22 hi..... 阅读(387) 评论(0) 推荐(0) 编辑
摘要: mongodb.driver mongodb.driver.core url: http://dl.mongodb.org/dl/win32/x86_64 ************************************************************************ 阅读全文
posted @ 2017-12-01 14:25 hi..... 阅读(331) 评论(0) 推荐(0) 编辑
摘要: string url = "https://oapi.dingtalk.com/robot/send?access_token=847bc045c802beaba749aec846f91901730f3b185ca"; var bl = new { msgtype = "text", text = 阅读全文
posted @ 2017-11-28 14:21 hi..... 阅读(217) 评论(0) 推荐(0) 编辑
摘要: update: I ran the exact same thing on Windows 7 and it worked exactly as needed. // using System.Net.Http;// using System.Security.Authentication;// u 阅读全文
posted @ 2017-11-09 13:10 hi..... 阅读(755) 评论(0) 推荐(0) 编辑
摘要: Microsoft Visual C++ 2010 SP1 Redistributable Package (x86) https://www.microsoft.com/en-us/download/details.aspx?id=8328 Microsoft Visual C++ 2010 SP 阅读全文
posted @ 2017-11-07 11:52 hi..... 阅读(2300) 评论(0) 推荐(0) 编辑
摘要: 需要调用的 Controller类上加上验证类名 using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using WebApplication1.A 阅读全文
posted @ 2017-10-30 16:55 hi..... 阅读(160) 评论(0) 推荐(0) 编辑
摘要: /// /// HTTP消息拦截器 /// public class RequestHandler : DelegatingHandler { /// /// 拦截请求 /// /// 请求 /// 用于发送取消操作信号 /// protect... 阅读全文
posted @ 2017-10-30 16:52 hi..... 阅读(494) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示