VB中使用三種不同組件內(nèi)存解壓結(jié)果分析比較_第1頁(yè)
VB中使用三種不同組件內(nèi)存解壓結(jié)果分析比較_第2頁(yè)
VB中使用三種不同組件內(nèi)存解壓結(jié)果分析比較_第3頁(yè)
VB中使用三種不同組件內(nèi)存解壓結(jié)果分析比較_第4頁(yè)
VB中使用三種不同組件內(nèi)存解壓結(jié)果分析比較_第5頁(yè)
已閱讀5頁(yè),還剩4頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、VB中使用三種不同組件進(jìn)行內(nèi)存解壓的結(jié)果分析比較本文采用三種不同軟件公司的動(dòng)態(tài)鏈接庫(kù)組件,分別進(jìn)行內(nèi)存解壓縮實(shí)驗(yàn),這三種組件分別是:1、 使用zlib 軟件公司的zlib.dll動(dòng)態(tài)鏈接庫(kù)組件進(jìn)行內(nèi)存解壓2、 使用info-zip軟件公司的vbuzip10.dll(也就是unzip32.dll)動(dòng)態(tài)鏈接庫(kù)組件進(jìn)行內(nèi)存解壓3、 使用xceed軟件公司的xceed zip compression library V5.0版本的xceedzip.dll動(dòng)態(tài)鏈接庫(kù)組件進(jìn)行內(nèi)存解壓利用上述三種不同軟件公司的動(dòng)態(tài)鏈接庫(kù)組件,對(duì)解壓前大小為229046805字節(jié)的壓縮文件進(jìn)行解壓實(shí)驗(yàn),實(shí)驗(yàn)結(jié)果如下:1、采用

2、三種不同軟件公司的動(dòng)態(tài)鏈接庫(kù)組件分別進(jìn)行內(nèi)存解壓,三次內(nèi)存解壓所用時(shí)間(毫秒)如下: 軟件名稱 第一次 第二次 第三次 平均時(shí)間vbuzip10.dll: 1734 1703 1672 1703xceedzip.dll: 9562 4313 4453 6109.3zlib.dll: 2594 2563 2562 2573從上面數(shù)據(jù)可以看出,使用info-zip軟件公司的vbuzip10.dll組件進(jìn)行內(nèi)存解壓,所用時(shí)間最少,即采用vbuzip10.dll組件進(jìn)行內(nèi)存解壓的速度最快,其次是zlib.dll,速度最慢的是xceedzip.dll。2、使用info-zip軟件公司的vbuzip10.

3、dll組件進(jìn)行內(nèi)存解壓,對(duì)于被解壓的壓縮文件,如果文件較?。ń鈮呵白止?jié)大小少于1016字節(jié)的壓縮文件),解壓后可以得到所有的文件內(nèi)容;但如果文件較大(解壓前字節(jié)大小大于2807字節(jié)的壓縮文件),解壓后最多只能得到2807字節(jié)的文件內(nèi)容。其它內(nèi)容雖然也在內(nèi)存中,但無(wú)法讀取。同時(shí),當(dāng)文件較大(解壓前字節(jié)大小大于1016字節(jié)的壓縮文件),解壓時(shí)甚至?xí)霈F(xiàn)程序運(yùn)行崩潰的情況,因此,使用info-zip軟件公司的vbuzip10.dll組件進(jìn)行內(nèi)存解壓,很不可靠。3、使用info-zip軟件公司的vbuzip10.dll組件進(jìn)行內(nèi)存解壓,得到的解壓后的內(nèi)容,直接就可以得到字符串,不用再進(jìn)行字節(jié)到字符串的

4、轉(zhuǎn)換;而用xceedzip.dll和zlib.dll組件進(jìn)行內(nèi)存解壓,得到的解壓后的內(nèi)容是字節(jié)數(shù)組,不是字符串,需要通過(guò)字節(jié)數(shù)組到字符串的轉(zhuǎn)換,才能得到真正的字符串,如果不進(jìn)行字節(jié)數(shù)組到字符串的轉(zhuǎn)換,則得到的字符串是一串亂碼。4、使用zlib.dll組件進(jìn)行內(nèi)存解壓,只需要在VB的申明部分用下列語(yǔ)句進(jìn)行申明: 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然后在程序中加入下列語(yǔ)句,即可在程序中調(diào)用他們的函數(shù)進(jìn)行內(nèi)存解壓縮: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)解壓后得到的內(nèi)容在str_tmp字

9、符串變量中:5、使用vbuzip10.dll組件進(jìn)行內(nèi)存解壓,只需要在VB的申明部分用下列語(yǔ)句進(jìn)行申明, 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然后在程序中加入下列語(yǔ)句,即可在程序中調(diào)用他們的函數(shù)進(jìn)行內(nèi)存解壓縮: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)解壓后得到的內(nèi)容在retstr.buffer字符串變量中:6、使用xceedzip.dll組件進(jìn)行內(nèi)存解壓,比較麻煩,需要先在計(jì)算機(jī)上運(yùn)行XceedComponents.exe程序,安裝xceed zip compressi

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論