VB中使用三种不同组件内存解压结果分析比较_第1页
VB中使用三种不同组件内存解压结果分析比较_第2页
VB中使用三种不同组件内存解压结果分析比较_第3页
VB中使用三种不同组件内存解压结果分析比较_第4页
VB中使用三种不同组件内存解压结果分析比较_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、VB中使用三种不同组件进行内存解压的结果分析比较本文采用三种不同软件公司的动态链接库组件,分别进行内存解压缩实验,这三种组件分别是:1、 使用zlib 软件公司的zlib.dll动态链接库组件进行内存解压2、 使用info-zip软件公司的vbuzip10.dll(也就是unzip32.dll)动态链接库组件进行内存解压3、 使用xceed软件公司的xceed zip compression library V5.0版本的xceedzip.dll动态链接库组件进行内存解压利用上述三种不同软件公司的动态链接库组件,对解压前大小为229046805字节的压缩文件进行解压实验,实验结果如下:1、采用

2、三种不同软件公司的动态链接库组件分别进行内存解压,三次内存解压所用时间(毫秒)如下: 软件名称 第一次 第二次 第三次 平均时间vbuzip10.dll: 1734 1703 1672 1703xceedzip.dll: 9562 4313 4453 6109.3zlib.dll: 2594 2563 2562 2573从上面数据可以看出,使用info-zip软件公司的vbuzip10.dll组件进行内存解压,所用时间最少,即采用vbuzip10.dll组件进行内存解压的速度最快,其次是zlib.dll,速度最慢的是xceedzip.dll。2、使用info-zip软件公司的vbuzip10.

3、dll组件进行内存解压,对于被解压的压缩文件,如果文件较小(解压前字节大小少于1016字节的压缩文件),解压后可以得到所有的文件内容;但如果文件较大(解压前字节大小大于2807字节的压缩文件),解压后最多只能得到2807字节的文件内容。其它内容虽然也在内存中,但无法读取。同时,当文件较大(解压前字节大小大于1016字节的压缩文件),解压时甚至会出现程序运行崩溃的情况,因此,使用info-zip软件公司的vbuzip10.dll组件进行内存解压,很不可靠。3、使用info-zip软件公司的vbuzip10.dll组件进行内存解压,得到的解压后的内容,直接就可以得到字符串,不用再进行字节到字符串的

4、转换;而用xceedzip.dll和zlib.dll组件进行内存解压,得到的解压后的内容是字节数组,不是字符串,需要通过字节数组到字符串的转换,才能得到真正的字符串,如果不进行字节数组到字符串的转换,则得到的字符串是一串乱码。4、使用zlib.dll组件进行内存解压,只需要在VB的申明部分用下列语句进行申明: Private Declare Function unzOpen Lib "ZLIB.DLL" (ByVal FilePath As String) As LongPrivate Declare Function unzClose Lib "ZLIB.DLL

5、" (ByVal hFile As Long) As LongPrivate Declare Function unzGetGlobalInfo Lib "ZLIB.DLL" (ByVal hFile As Long, ByRef pglobal_info As unz_global_info) As LongPrivate Declare Function unzGetCurrentFileInfo Lib "ZLIB.DLL" (ByVal hFile As Long, ByRef pfile_info As unz_file_info,

6、ByVal szFileName As String, ByVal fileNameBufferSize As Long, ByRef extraField As Long, ByVal extraFieldBufferSize As Long, ByVal szComment As String, ByVal commentBufferSize As String) As LongPrivate Declare Function unzOpenCurrentFile Lib "ZLIB.DLL" (ByVal hFile As Long) As LongPrivate D

7、eclare Function unzCloseCurrentFile Lib "ZLIB.DLL" (ByVal hFile As Long) As LongPrivate Declare Function unzReadCurrentFile Lib "ZLIB.DLL" (ByVal hFile As Long, ByRef Buffer As Byte, ByVal BuffLen As Long) As LongPrivate Declare Function unzGoToNextFile Lib "ZLIB.DLL" (

8、ByVal hFile As Long) As Long然后在程序中加入下列语句,即可在程序中调用他们的函数进行内存解压缩:Dim zipfilename As String, str_tmp As String, filenameinzip As Stringzipfilename = "q-20151010-1406-0000-4.zip"filenameinzip = "q-20151010-pfsjnl.bin"str_tmp = UnZipToMemory(zipfilename, filenameinzip)解压后得到的内容在str_tmp字

9、符串变量中:5、使用vbuzip10.dll组件进行内存解压,只需要在VB的申明部分用下列语句进行申明, Public Declare Function Wiz_UnzipToMemory Lib "vbuzip10.dll" (ByVal zip As String, ByVal file As String, ByRef lpUserFunc As LPUSERFUNCTIONS, ByRef retstr As UzpBuffer) As LongPublic Declare Sub UzpFreeMemBuffer Lib "vbuzip10.dll&qu

10、ot; (ByRef retstr As UzpBuffer)Public Type UzpBuffer strlength As Long Buffer As StringEnd TypePrivate Type UNZIPCBChar ch(32800) As ByteEnd TypePrivate Type UNZIPCBCh ch(256) As ByteEnd TypePublic Type LPUSERFUNCTIONSprintwq As Long 'DLLPRNT * = a pointer to the application's print routine.

11、sound As Long 'DLLSND * = a pointer to the application's sound routine. This ' can be NULL if your application doesn't use sound.replace As Long 'DLLREPLACE * = a pointer to the application's replace routine.password As Long 'DLLPASSWORD * = a pointer to the application&#

12、39;s password routine.SendApplicationMessage As Long 'DLLMESSAGE * = a pointer to the application's routine 'for displaying information about specific files 'in the archive. Used for listing the contents of an archive.ServCallBk As Long 'DLLSERVICE * = Callback function designed

13、to be used for ' allowing the application to process Windows messages, ' or canceling the operation, as well as giving the ' option of a progress indicator. If this function ' returns a non-zero value, then it will terminate ' what it is doing. It provides the application with &#

14、39; the name of the name of the archive member it has ' just processed, as well as it's original size.'NOTE: The values below are filled in only when listing the contents of an archive.TotalSizeComp As Long '= value to be filled in by the dll for the 'compressed total size of the

15、 archive. Note this 'value does not include the size of the archive 'header and central directory list.TotalSize As Long '= value to be filled in by the dll for the total ' size of all files in the archive.CompFactor As Long '= value to be filled in by the dll for the overall 

16、9; compression factor. This could actually be computed ' from the other values, but it is available.NumMembers As Long '= total number of files in the archive.cchComment As Integer 'WORD = flag to be set if archive has a commentEnd Type然后在程序中加入下列语句,即可在程序中调用他们的函数进行内存解压缩:Dim retstr As UzpB

17、uffer, UZUSER As LPUSERFUNCTIONS, long_result As Long, zipfilename As String, filenameinzip As String UZUSER.printwq = FnPtr(AddressOf UZDLLPrnt) UZUSER.sound = 0& '- Not Supported UZUSER.replace = FnPtr(AddressOf UZDLLRep) UZUSER.password = FnPtr(AddressOf UZDLLPass) UZUSER.SendApplicationM

18、essage = FnPtr(AddressOf UZReceiveDLLMessage) UZUSER.ServCallBk = FnPtr(AddressOf UZDLLServ)zipfilename = "q-20151010-1406-0000-4.zip"filenameinzip = "q-20151010-pfsjnl.bin"long_result = Wiz_UnzipToMemory(zipfilename, filenameinzip, UZUSER, retstr)解压后得到的内容在retstr.buffer字符串变量中:6、使用xceedzip.dll组件进行内存解压,比较麻烦,需要先在计算机上运行XceedComponents.exe程序,安装xceed zip compressi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论