Delphi 对GZIP解压

作者:admin 来源:未知 日期:2010/5/9 13:08:46 人气:获取失败 标签:

呵呵,终于做出来了,有一定收获, 
在算法上还是花了不少时间, 
以前解gzip内容,现在是deflate,少了文件头内容,所以 
用以前思路老是碰到"data error"问题。 
用的是zLib控件: 
(http://www.2ccc.com/article.asp?articleid=4269)

下面是可以运行的代码片断: 
uses ZLibEx;

procedure TForm1.Button3Click(Sender: TObject); 
var 
url: string; 
IdHTTP: TIdHTTP; 
stream, out_stream: TMemoryStream; 
begin 
url := 'http://bill.finance.sina.com.cn/bill/trade_item.php?stock_code=sh580013&pages=0&time=1218809515'; 
IdHTTP := TIdHTTP.Create(nil);

stream := TMemoryStream.Create; 
out_stream := TMemoryStream.Create; 
try 
IdHTTP.get(url, stream); 
stream.Position:=0; 
ZLibEx.ZDecompressStream2(stream, out_stream, -15); 
stream.SaveToFile('c:\1.txt'); 
out_stream.SaveToFile('c:\2.txt'); //这个就是我们要的html内容 
finally 
stream.Free; 
out_stream.Free; 
IdHTTP.Free; 
end; 
end; 

delphi对ZIP解压的更多相关文章

  1. CentOS7下zip解压和unzip压缩文件

    1.安装zip.unzip应用. yum install zip unzip

  2. MySQL For Windows Zip解压版安装

    前言 Windows 下 MySQL 有msi和zip解压安装版两种,而zip版只需解压并做简单配置后就能使用,我个人比较喜欢这种方式. 注意我们这里说的MySQL是指MySQL服务器,有很多初学的同 ...

  3. 解决ubuntu中zip解压的中文乱码问题

    转自解决ubuntu中zip解压的中文乱码问题 在我的ubuntu12.10中,发现显示中文基本都是正常的,只有在解压windows传过来的zip文件时,才会出现乱码.所以,我用另一个方法解决中文乱码 ...

  4. JAVA zip解压 MALFORMED 错误

    最近在在使用zip 解压时,使用JDK1.7及以上版本在解压时,某些文件会报异常 Exception in thread "main" java.lang.IllegalArgum ...

  5. windows下tomcat zip解压版安装方法

    下面记录一下在win7(32位)系统下,安装zip解压版的方法: 一.下载zip压缩包 地址:http://tomcat.apache.org/download-80.cgi 二.解压 我把解压包解压 ...

  6. 【转载】在linux下别用zip 用tar来压缩文件 zip解压后还是utf-8 window10是GBK

    3.2 使用 unzip 命令解压缩 zip 文件 将 shiyanlou.zip 解压到当前目录:   $ unzip shiyanlou.zip 使用安静模式,将文件解压到指定目录:   $ un ...

  7. Java zip解压,并遍历zip中的配置文件 .cfg或.properties

    1.解析cfg或properties配置文件 讲配置文件,读取,并封装成为map类型数据 /** * 解析cfg文件 * * @param cfgFile * @return */ public st ...

  8. ubuntu zip解压

    您好,zip xx.zip压缩,unzip xx.zip 解压,tar zcvf xx.tar.gz压缩tar zxvf xx.tar.gz解压

  9. zip 解压脚本

    zip 解压脚本 gpk-unzip.py #!/usr/bin/env python # -*- coding: utf-8 -*- # unzip-gbk.py import os import ...

随机推荐

  1. RestTemplate的异常 Not enough variables available to expand

    当使用 RestTemplate 可能会遇到异常: Not enough variables available to expand 典型如下: @Autowired private RestTemp ...

  2. springBoot+MybatisPlus数据库字段使用驼峰命名法时报错

    假如有个实体类: package com.jeff.entity; public class User { /** * 主键id */ private Integer id; /** * 登陆名 */ ...

  3. Practical aspects of deep learning

    If your Neural Network model seems to have high variance, what of the following would be promising t ...

  4. iOS之Xcode提交App中断出现:Cannot proceed with delivery: an existing transporter instance is currently uploading this package

    https://www.jianshu.com/p/6d465a0ea58e 这句英文翻译过来就是: 无法继续交付:现有的传输程序实例目前正在上载此包 原因:上传的动作被记录在UploadToken中 ...

  5. 使用外网访问Flask项目

    在学习flask过程中,想使用手机访问项目,根据flask手册中可以将 app.run(host='192.168.1.109', port=8000,debug=True) 但是发现手机依然无法连接 ...

  6. A easy and simple way to establish Oracle ADG

    Yes, thanks to Then, I can give simple and reasy way to make it. Suppose hosts and IPs like that: 15 ...

  7. kubernetes 1.17.2 kubeadm部署 证书修改为100年

    [root@hs-k8s-master01 ~]# cd /data/ [root@hs-k8s-master01 data]# ls docker [root@hs-k8s-master01 dat ...

  8. gets和scanf区别

    scanf 和 gets 读取字符串 深入了解scanf()/getchar()和gets()等函数 scanf与gets函数读取字符串的区别 今天看到一段话,大致是说gets比scanf()快,有点 ...

  9. 利用kali自带的msfvenom工具生成远程控制软件(木马)

    2.生成一个简单的木马 3. 4. 5. 6.接下来生成的winx64muma.exe实际演示 7.将生成的winx64muma.exe在受害者机器上运行 8.在kali下输入msfconsole 9 ...

  10. JS中的原始类型和判断方法

    ECMAScript 中定义了 7 种原始类型: Boolean String Number Null Undefined Symbol(新定义) BigInt(新定义) 注意: 原始类型不包含 Ob ...