06-07-2012 06:05 AM
Some of you might have found this:
In that, I said in one of the posts, that you needed to know what files were in your package, but added "see later".
Finally, here is the "see later", which has been prompted by this Thread:
The attached file is a zip archive. Please unzip it and you will find a JDE project. In that project there is some code and another a zip archive. The code processes the internal zip archive, reading the directory and writing all the files from the archive to the SD Card.
This I think is useful in itself - you could use this project, stick you own zip archive in it and you have an installer!
And I suspect the Unzip code contained might be useful too. This uses the native decompression built in to the Blackberry, so is as fast as it can be.
I actually use a zip archive as a repository for data, so that in some applications, the archive is never actually unzipped, it is just copied to the SD Card and left there as an archive.
My testing suggested it was actually faster to leave the zip archive intact and process files directly from it, rather than unzipping and processing the files on the SD Card. In my testing, it seemed that there was a load of overhead associated with opening (or perhaps finding) each file on the SD Card - this is removed using the Unzip processing because the SD Card file (i.e. the archive) is only opened once.
It has actually been waiting for me to find an excuse to publish, I am sorry it has taken so long.
Also apologies, this is a JDE project.
This code is offered with no support, you are on your own. But I can assure you that there are applications on App World using this code. And I will try to answer questions.
And most importantly it is offered free, without any reservation. And while there are parts that look like Java ZIP Library and zipme - this is because I was looking for a good architecture. It is my own code. So copy and paste to your heart's content. No need to credit me, it can be all your own work if you want!
Solved! Go to Solution.
10-23-2012 10:29 AM
Trying to test the project.
I imported the project to Eclipse, no problem. Cleaned it and packaged it, no problem.
Tried to run it on a simulator. Got uncaught excption before any screen showed. Run it in debug and got this message:
Error starting com_sample_install_Installer: Module 'com_sample_install_Installer' has verification [0.0] error 2618 at offset 002d (codfile version 78)
I used API 5.0
10-27-2012 06:44 PM
Tried that. Did not help. Did not make a change on all classes but a few. Clean all and package.
It is not a problem for me any more. I just picked the classes I needed for a background unzip and added code to transfer the zip file from a website to theSD card. Also created a stripped down version of the UnzipRunnable that is not a thread since the calling class is threaded anyway.
Works nice, thanks a lot
10-28-2012 09:40 PM
OK, that works for me!
Can you tell me the Eclipse level, plug-in level and OS level you were compiling against? I might (given time) attempt to replicate. I think the project was originally built in JDE actualy so perhaps I should rebuild in Eclipse anyway....
10-29-2012 03:43 AM
Eclipse Juno, Service Release 1.jde and jre 5.0
Having some problem with a bit "complicated" structure of the zip. It contains one folder and that folder contains 2 files and a second folder. The second folder contains a number of files as well as a number of folders containing files.
I have made some changes in the code so maybe that is causing it to only unzip one of the foilders on the second level. Have to walk thru it
10-29-2012 05:47 AM
"Having some problem with a bit "complicated" structure of the zip"
The code should cope with that, but you need to detect the directory component in the file name. Also I seem to remember that some zip creators put 'directory' entries in the zip archive. These entries contain no data, they are useful so that a zip archive can be unzipped and still cr3ate empty directories. I am not sure that I have ever tested these because nothing I have used this code for did that.
10-29-2012 07:10 AM
Code error elsewhere. Everything extracted properly it seems.
Thanks a lot a gain!
10-29-2012 09:50 AM
Absolutely. When time permits check out why an import to Eclipse causes trouble.
Did not see a "solved" button or choice anywhere otherwise I would have done it