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
My Carrier: +923224514012

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: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: how i can unzip a zip file in SDcard

Hi Umer,

 

See this link,

 

http://stackoverflow.com/questions/4505515/unzip-a-zip-file-in-blackberry-java-app

 

The above link states that some third party libraries available for this.

Try to search on that.

 

Thanks.

 

 

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

Re: how i can unzip a zip file in SDcard

Thank you so much dear 

 

but i have use also zipme third party tool but i dont known how i can use it? can you explain it and given some example ?

 

Thanks

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: how i can unzip a zip file in SDcard

Can I recommend that you use search on this forum.for ansswers to question, there has been a reasonable amount of discussion on the forum about this sort of thing.

 

And I suspect this link provides you with the code and sample you need. 

 

http://supportforums.blackberry.com/t5/Java-Development/Unzip-zip-archive-with-sample-resource-insta...