Welcome!

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

Reply
New Contributor
Posts: 4
Registered: ‎06-25-2012
My Device: All devioces

how i can unzip a zip file in SDcard

hi all !

i am new in blackberry and iam trying to unzip a zip file but i cant please give the code how i can unzip a zip file here is my code:- 

 

 

System.out.println("unzip 1");
 int i = 0;
 System.out.println("unzip 2");
 String filePath = "file:///SDCard/BlackBerry/documents/google_transit.zip";
 System.out.println("unzip 3");
 FileConnection file = (FileConnection) Connector.open(filePath);
 StringBuffer sb = new StringBuffer();
 System.out.println("unzip 4");
 InputStream inputStream = connection.openInputStream();
 System.out.println("unzip 5");
 GZIPInputStream gzis = new GZIPInputStream(inputStream);
 System.out.println("unzip 6");
 while ((i = gzis.read()) != -1)
 {
 System.out.println("unzip 7");
 sb.append((char)i);
 System.out.println("unzip 8");
 }
 System.out.println("unzip 9");
 String data = sb.toString();
 System.out.println("unzip 10");
 //add(new RichTextField(data));
 System.out.println("Decompressed Values : " + data);
 System.out.println("unzip 11");
 gzis.close();
 System.out.println("unzip 12");
 }
catch(IOException e)
{
System.out.println("IO EXCEPTION =================== " + e.getMessage().toString());
e.printStackTrace();
}
}

Developer
Posts: 16,575
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: how i can unzip a zip file in SDcard

gzip is not the same as zip.
enter zip in the search field and you'll get a few helpful posts.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter