Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Contributor
Posts: 6
Registered: ‎08-18-2010
My Device: Not Specified

unzip using zipinpustream

[ Edited ]

Hi to all,

As i m very new in BB dev.


I m trying to unzip a zip file using zipinpu/zipoutput stram for BB os 4.6, please see the code bleow and help me.


FileConnection fc;
        ZipInputStream zinstream;
        String fName = "test.zip";
        byte[] buf = new byte[1024];
         fc= (FileConnection)Connector.open(fName);
        zinstream = new ZipInputStream(fc.openInputStream());
        ZipEntry zentry = zinstream.getNextEntry();
        Dialog.alert("Name of current Zip Entry : " + zentry + "\n");
        while (zentry != null) {
          String entryName = zentry.getName();
          Dialog.alert("Name of  Zip Entry : " + entryName);
        FileOutputStream outstream = new FileOutputStream(0, entryName); // Robot Happyhere i m getting err "null"
          int n;
          while ((n = zinstream.read(buf, 0, 1024)) > -1) {
            outstream.write(buf, 0, n);

          Dialog.alert("Successfully Extracted File Name : " + entryName);

          zentry = zinstream.getNextEntry();
        }catch(final Exception e){
            UiApplication.getUiApplication().invokeLater(new Runnable() {
                public void run() {
                Dialog.alert("Err "+e.getMessage());


thnx in advance

New Contributor
Posts: 4
Registered: ‎06-25-2012
My Device: All devioces
My Carrier: +923224514012

unzip using zipinpustream

Hi to all 


As i m very new in BB dev.


I m trying to unzip a zip file in SDcard please give me any example to help me in this problem .