Reading and writing zip files?

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Reading and writing zip files?

Postby dmacqueen » Sat Jun 14, 2008 4:23 am

This may be my latest number one priority on JWARS. Any ideas, pointers, or -especially- code appreciated.

Thanks.

Donald

| jWarrior |
dmacqueen
[|]
 
Posts: 27
Joined: Fri Nov 02, 2007 3:40 pm

Re: Reading and writing zip files?

Postby marten » Sat Jun 14, 2008 11:46 am

Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Reading and writing zip files?

Postby schepurny » Mon Jun 16, 2008 6:28 am

I'm not sure how much this helps, but I vaguely recall doing this about 7-8 years ago. I just used the java classes for zipping/unzipping a jar file, wrapped them with a more convenient helper class, and then called them from a Smaltalk client using rmi over iiop passing in a filename to be input or output.

It worked fine after some trial and error. I'm sure there would be some GC issues if that type of operation was executed on a frequent basis.
schepurny
 
Posts: 16
Joined: Tue Jan 15, 2008 10:23 am

Re: Reading and writing zip files?

Postby marten » Mon Jun 16, 2008 8:03 am

schepurny wrote:I'm not sure how much this helps, but I vaguely recall doing this about 7-8 years ago. I just used the java classes for zipping/unzipping a jar file, wrapped them with a more convenient helper class, and then called them from a Smaltalk client using rmi over iiop passing in a filename to be input or output.

It worked fine after some trial and error. I'm sure there would be some GC issues if that type of operation was executed on a frequent basis.


Well, then it might be much easier to call zip/unzip executable directly ....
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Reading and writing zip files?

Postby schepurny » Mon Jun 16, 2008 9:17 am

It absolutely is. It all depends on how transparent you want extracting and creating zip files to be.
schepurny
 
Posts: 16
Joined: Tue Jan 15, 2008 10:23 am

Re: Reading and writing zip files?

Postby PhotonDemon » Wed Jun 18, 2008 5:22 am

I use the following to zip a file with InfoZip's zip program. I think is does so quietly, without opening an windows.

Lou

zip: fileName to: zipFileName
"Private - zip the file."
| cmdStream cmdLine result startUpInfo os startedOk processInfo exitCodeBytes lastZipExitCode |

cmdStream := WriteStream on: ''.
cmdStream
nextPutAll: 'Zip32.Exe -j9 ';
nextPut: $"; nextPutAll: zipFileName; nextPut: $";
space;
nextPut: $"; nextPutAll: fileName; nextPut: $".
cmdLine := cmdStream contents.

startUpInfo := OSStartupinfo new.
startUpInfo
dwFlags: 1; "1 - startf_useshowwindow"
wShowWindow: 0. "0 - do not show window"

processInfo := OSProcessInformation new.
os := OSCall new.
startedOk := os
createProcess: nil
lpszCommandLine: cmdLine
lpsaProcess: 0
lpsaThread: 0
fInheritHandles: false
fdwCreate: 0
lpvEnvironment: 0
lpszCurDir: nil
lpsiStartInfo: startUpInfo
lppiProcInfo: processInfo.

result := startedOk ifTrue: [
processInfo hProcess waitForSingleObject: -1.
exitCodeBytes := ByteArray new: 4.
processInfo hProcess getExitCodeProcess: exitCodeBytes.
processInfo hProcess closeHandle.
processInfo hThread closeHandle.
lastZipExitCode := exitCodeBytes int32At: 0.
(lastZipExitCode <= 1).
] ifFalse: [false].

^result.
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm

Re: Reading and writing zip files?

Postby gkipe » Tue Feb 03, 2009 1:11 pm

I would like to get my hands on the code that "schepurny" is talking about, so I went to the link that "marten" posted and can't get the App to import in VA. Has anyone had luck in the import, or does anyone have this RMI-IIOP code? Thanks, Garet
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Reading and writing zip files?

Postby louis_andriese » Wed Feb 04, 2009 12:08 am

on http://www.smalltalking.net/Goodies/VisualAGE/index.htm you can download a wrapper for the opensource zlib-library from infozip. It supports zipping and unzipping on windows-platforms.

Kind regards,

Louis
louis_andriese
 
Posts: 20
Joined: Thu Dec 13, 2007 5:19 am
Location: Waalwijk, The Netherlands

Re: Reading and writing zip files?

Postby marten » Wed Feb 04, 2009 5:19 am

louis_andriese wrote:on http://www.smalltalking.net/Goodies/VisualAGE/index.htm you can download a wrapper for the opensource zlib-library from infozip. It supports zipping and unzipping on windows-platforms.

Kind regards,

Louis


Fine, this seems to be the code I thought I published again ... (in a wrong way as I now know). Good to know, where the source comes from. Be aware, that this software depends on the "old" zip.dll - the newer ones have a new API and are located around 2005. You might not be able to exchange the actual dll with that one in the archive.

Marten
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Reading and writing zip files?

Postby schepurny » Wed Feb 04, 2009 6:32 am

gkipe wrote:I would like to get my hands on the code that "schepurny" is talking about, so I went to the link that "marten" posted and can't get the App to import in VA. Has anyone had luck in the import, or does anyone have this RMI-IIOP code? Thanks, Garet


Well that was a few companies ago for me so I no longer have that code. It's fairly simple though, there's plenty of java and C++ examples out there to unzip a file, just call them from VA.
schepurny
 
Posts: 16
Joined: Tue Jan 15, 2008 10:23 am


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest