Extract the zip file in the BlackBerry Java app
•
Java
I'm trying to write code to unzip the zip archive and put the output in another folder
Do I have to use a third-party library? Does anyone have some code for me to start?
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(); }
Solution
Use zipme to extract the zip archive file in the Java ME / BlackBerry application
Take a look at the 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(); }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码