| Dart Home | PowerTCP Zip Compression for Active | Custom Development | Reply | PowerTCP Zip Compression for ActiveX Topics | Forums |
| Author | Forum: PowerTCP Zip Compression for ActiveX Topic: DartStreams - cannot uncompress |
| N/A | posted May 22, 2002 9:30 PM Hi, I'm having trouble using the DartStream object to compress/uncompress data in memory. The source data is in a file so I add that to the FileStore, instantiate a DartStream and call the FileStore.Zip method with the destination being my DartStream. This works fine, I can dump the compressed data into a local string variable and store it. However, I cannot UNcompress this data: I create a new stream and use the .Write method to put the contents of the string onto the DartStream. Then I add the DartStream to the FileStore object and call Extract with the destination being a further DartStream. No error message is raised, but there is no data in the destination DartStream. Can someone tell me where I'm going wrong? Below is sample code that duplicates this problem, Thanks - Phil Dim objZip As Zip Dim strFilename As String Dim StreamZipped As DartStream Dim StreamUnZipped As DartStream Dim strTest As String strFilename = App.Path & "\<SOMEFILE>" Set objZip = New Zip objZip.FileStore.Add strFilename Set StreamZipped = New DartStream objZip.FileStore.Zip StreamZipped StreamZipped.Position = 0 strTest = StreamZipped.ReadString '* Store the Stream data in a string Set StreamZipped = Nothing Set objZip = Nothing Set objZip = New Zip Set StreamZipped = New DartStream StreamZipped.Write strTest '* Drop the string into the stream StreamZipped.Position = 0 objZip.FileStore.Add StreamZipped strTest = "" '* Blank the temporary string Set StreamUnZipped = New DartStream objZip.FileStore(1).Extract StreamUnZipped StreamUnZipped.Position = 0 StreamUnZipped.Write strTest '* No data returned in strTest |
| N/A | posted May 23, 2002 9:24 AM Hi, It looks like you are trying to extract an unzipped file. Below I have code that should do what you are attempting. Hope it helps, -ken Option Explicit Private WithEvents objZip As Zip Private Sub Command1_Click() Set objZip = New Zip Dim dsZipped As New DartStream Dim dsUnzipped As New DartStream Dim strTest As String objZip.FileStore.Add App.Path & "\<SOMEFILE>" objZip.FileStore.Zip dsZipped objZip.FileStore.Clear objZip.FileStore.Load dsZipped objZip.FileStore(1).Extract dsUnzipped dsUnzipped.Position = 0 strTest = dsUnzipped.ReadString End Sub K M Drake Dart Tech Support |
| Phil From: Auckland, New Zealand Posts: 1 Member Since: 05/27/02 |
posted May 27, 2002 4:20 PM Thanks, Ken, that did the trick. |
| Reply | PowerTCP Zip Compression for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|