Recently, we developed a small program that uses gzipstream in. Net to compress and decompress the GZIP file. Gzipstream is easy to use under system. Io. compression. Although gzipstream is a lower-level class of the stream class, it is equivalent
In the process of crawling the page, in the store crawl to the content of the page I need to first compress and then store the page, in order to use the convenience, using 2.0 GZipStream to compress.
The reference is as follows:
using System.IO;
Brief introduction:
GZipStream represents the gzip data format, which uses an industry-standard algorithm for lossless compression and decompression of files. This format includes a cyclic redundancy check value for detecting data
1> File compression process:
1. Create read stream file. openread ()2. Create a write stream file. openwrite ();3. Create a compressed stream new gzipstream (). Write the stream as the parameter and.4. read part of data each time by reading the
GZipStream class
Provides methods and attributes for compressing and extracting streams.
This class represents the GZip data format, which uses industry-standard algorithms for lossless compression and decompression of files. This format includes a
With the System.IO.Compression class added to the. Net Framework 2.0 for compressing/decompressing files (GZipStream methods), let's look at a simple example.
Code1:
1 public static void Compress (String filePath, String zippath)2 {3 FileStream
Requires the first using
Using System.IO;Using System.IO.Compression;
Compressionprivate void Compress (stream source, stream dest) {using (GZipStream ZIPstream = new GZipStream (dest, compressionmode.compress, True)) {byte[] buf = new
Writing the following code makes me very laborious.. Net provides the Compression example of System. IO. Compression. GZipStream, but there is no good code for decompression.However, after extracting a section and compressing it, it becomes 1.16 MB,
IntroductionDevelopers often worry about the performance of their web sites. Every developer wants to optimize the performance of their web sites. Viewstate is one of the many factors that affect your website performance. This article will provide
Address: http://www.dotnetbips.com/articles/22d33d11-1a75-42c8-bbf6-ca1a345d3fcf.aspx
[Source code download]
[Translation] Improving Performance by compressing ViewState in asp.net 2.0
Original article released on: 2007.03.08Author: Bipin
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.