这是个简版的,可以拿来做下网页gzip的解压缩,整好我的webserver还不支持这个,有时间了就加上。

zlib.dll下载请点击我!

模块zlib.bas的代码如下:

 'code by lichmam from cnblogs.com
'whatfor: could be used for http-gziped compress&uncompress
'API declares from zlib.dll
Private Declare Function compress2 Lib "zlib.dll" (dest As Any, _
destLen As Any, _
src As Any, _
ByVal srcLen As Long, _
ByVal level As Long) As Long
Private Declare Function uncompress Lib "zlib.dll" (dest As Any, _
destLen As Any, _
src As Any, _
ByVal srcLen As Long) As Long Public Function Compress(ByRef bytCompressed() As Byte, _
ByRef bytUnCompressed() As Byte, _
Optional CompressionLevel = &) As Long
'0<=CompressionLevel<=9, and default value is 6.
'with the number of CompressionLevel increased,
' the quality, speed of compression would be better and slower.
'however, i'd suggest that JUST TAKE THE DEFAULT VALUE OF COMPRESSION_LEVEL.
Dim srcLen As Long
Dim destLen As Long srcLen = UBound(bytUnCompressed) +
destLen = srcLen * ( + 0.01) +
ReDim bytCompressed(destLen) As Byte
Call compress2(bytCompressed(), destLen, bytUnCompressed(), srcLen, CompressionLevel)
Compress = destLen
End Function Public Function DeCompress(ByRef bytUnCompressed() As Byte, _
ByRef bytCompressed() As Byte) As Long Dim srcLen As Long
Dim destLen As Long srcLen = UBound(bytCompressed) +
destLen = srcLen
ReDim bytUnCompressed(destLen) As Byte
Call uncompress(bytUnCompressed(), destLen, bytCompressed(), srcLen)
DeCompress = destLen
End Function

VB6之借助zlib实现gzip解压缩的更多相关文章

  1. Windows API方式直接调用C#的DLL,支持多音字转拼音、Gzip解压缩、公式计算(VBA、C++、VB、Delphi甚至java都可以)

    原始链接 https://www.cnblogs.com/Charltsing/p/DllExport.html 这两年,我在VBA应用方面一直有几大痛点:1.多音字转拼音:2.64位下的GZIP解压 ...

  2. c语言使用zlib实现文本字符的gzip压缩与gzip解压缩

    网络上找到的好多方法在解压缩字符串的时候会丢失字符,这里是解决方法: http://stackoverflow.com/questions/21186535/compressing-decompres ...

  3. 使用zlib实现gzip格式数据的压缩和解压

    注意代码中的注释部分,这里设置是专门针对gzip的,缺少了就不行了,gzip压缩格式和其他格式的区别就在这里. Bytef 就是 unsigned char,uLong就是 unsigned long ...

  4. c# gzip解压缩

                , bytes.Length)) > )             {                line =  System.Text.Encoding.Defaul ...

  5. C#用Zlib压缩或解压缩字节数组

    /// <summary> /// 复制流 /// </summary> /// <param name="input">原始流</par ...

  6. qt 调用zlib压缩与解压缩功能

    Zlib是一种免费且通用的压缩库,由于Zlib压缩效果比LZW好,而且解压缩速度快,更重要的是商业软件中使用Zlib不需要缴纳版权费,所以很多游戏都使用Zlib压缩资源文件. Zlib是由Jean-l ...

  7. golang zlib 压缩,解压缩

    package main import ( "bytes" "compress/zlib" "fmt" "io" &qu ...

  8. http gzip 解压缩

    var sContentEncoding = httpRespone.Headers["Content-Encoding"]; if(sContentEncoding == &qu ...

  9. AXIS2调用web service,返回结果用GZIP解压缩

    import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOExceptio ...

随机推荐

  1. 017 多对多关联映射 双向(many-to-many)

    多对多关联映射 双向 两方都持有对象引用,修改对象模型,但数据的存储没有变化. 再修改映射文件: public class Role { private int id; private String ...

  2. 开涛spring3(5.4) - Spring表达式语言 之 5.4在Bean定义中使用EL

    5.4.1  xml风格的配置 SpEL支持在Bean定义时注入,默认使用“#{SpEL表达式}”表示,其中“#root”根对象默认可以认为是 ApplicationContext,只有Applica ...

  3. redis3.2.6 集群安装

    下载   [root@localhost ~]# cd /usr/local/src/ [root@localhost src]# wget http://download.redis.io/rele ...

  4. C# 类型基础(中)

    前一篇文章中我们讲到了值类型和引用类型的一些区别,那这篇我们将深入的分析一下到底有什么不一样 先总结一下两者的差别: 黄金法则: 1.引用类型总是被分配到托管堆上. 2.值类型总是分配到它声明的地方: ...

  5. TreeSet集合排序方式二:定制排序Comparator

    Comparator有两种实现方式: 1,匿名内部类 2,创建一个类用于实现Comparator,该类创建的对象就是比较器 Person类 public class Person implements ...

  6. Ch.3 Aray and String

    3-1 scrore  Here is a string with o and x. The length is between 1 to 80. Calcuate the score. The sc ...

  7. 【转】Delphi多线程编程

    文章来源: http://liukun966123.my.gsdn.net/2004/10/22/4797/ Delphi中有一个线程类TThread是用来实现多线程编程的,这个绝大多数Delphi书 ...

  8. 多线程异步编程示例和实践-Thread和ThreadPool

    说到多线程异步编程,总会说起Thread.ThreadPool.Task.TPL这一系列的技术.总结整理了一版编程示例和实践,分享给大家. 先从Thread和ThreadPool说起: 1. 创建并启 ...

  9. springMvc <form action="">提交跳转路径问题

    表单提交后,action的URL写的是, login/login.do,每次跳转后都变成login/ login/login.do,很显然是相对路径没有搞清楚. 应该弄清楚相对路径,并在JSP代码中加 ...

  10. git初步用法

    三.       Gerrit的注册及使用 1.         简介 Gerrit为代码审核工具,git提交的代码,必须经过审核才能合入到正式的版本库中. 2.         注册步骤 (1)   ...