Reputation: 539
I am trying to write code that unzips a zip archive and places the output in another folder.
Do I have to use a third party library? Does anyone have some code to get me started?
ZipEntry dataZE;
InputStream isData = getClass().getResourceAsStream("/" + dataName + ".zip");
StringBuffer sbData = new StringBuffer();
ZipInputStream dataZIS = new ZipInputStream(isData);
FileConnection file =
(FileConnection)Connector.open(
"file:///SDCard/BlackBerry/documents/" + filename,
Connector.READ_WRITE
);
if (!file.exists()) {
file.mkdir();
}
while ((dataZE = dataZIS.getNextEntry()) != null) {
out.write(dataZE );
out.flash();
dataZIS.closeEntry();
}
Upvotes: 3
Views: 5715
Reputation: 14453
Use ZipME for unzip the zip archive files in Java ME / Blackberry applications.
Look on this sample code:
ZipEntry dataZE;
InputStream isData = getClass().getResourceAsStream("/" + dataName + ".zip");
StringBuffer sbData = new StringBuffer();
ZipInputStream dataZIS = new ZipInputStream(isData);
while ((dataZE = dataZIS.getNextEntry()) != null) {
// do something...
dataZIS.closeEntry();
}
Upvotes: 7