BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-01-2009, 07:42 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Compress and Decompress using GZIP

Please Login to Remove!

Hi,
I want to compress and decompress data using gzip algorithm.

Please help,how do I achieve it?
Offline  
Old 06-01-2009, 09:55 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can use GZIPInputStream and GZIPOutputStream like you would other in/out streams to read and write.
Offline  
Old 06-02-2009, 02:49 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Bemshaswing,
Thanks for the reply.
I have tried using GZIPInputStream and GZIPOutputStream.

It will be gr8 if someone provides me with sample code
Offline  
Old 06-02-2009, 09:17 AM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

here's an example of how it's done in standard java link

which doesn't differ greatly from gZip reading of inputStream
Code:
StringBuffer rawResponse = new StringBuffer();
InputStream inputStream = //some input stream
	GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream);
				while (-1 != (length = gzipInputStream.read(responseData))) {
					rawResponse.append(new String(responseData, 0, length));
				
				}
Offline  
Old 06-04-2009, 05:37 AM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Bemshaswing,
Thanks for the reply.
It worked for me.

Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Mobile attachments diameter 23.4mm to mount in 2 step slit lamp BLACKBERRY Z-10
$99.99
Mobile attachments diameter 23.4mm to mount in 2 step slit lamp BLACKBERRY Z-10 pictureGarnier Ultra Blends Henna Blackberry Conditione 175ml
$15.0
Garnier Ultra Blends Henna Blackberry Conditione 175ml     pictureGarnier Ultra Blends Henna Blackberry Shampoo, 175ml Worldwide
$14.0
Garnier Ultra Blends Henna Blackberry Shampoo, 175ml  Worldwide pictureGarnier Ultra Blends Henna Blackberry Shampoo 340 ml Worldwide
$19.0
Garnier Ultra Blends Henna Blackberry Shampoo 340 ml  Worldwide pictureBlackberry ACC-52931-001 Earset
$13.92
Blackberry ACC-52931-001 Earset picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.