BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 06-01-2009, 07:42 AM   #1
itsteju
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
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
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
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
itsteju
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
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
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
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
itsteju
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
Default

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

Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


REPLACEMENT LCD FOR SAMSUNG DISPLAY UNIT DBM-091 PLEASE READ DESCRIPTION picture

REPLACEMENT LCD FOR SAMSUNG DISPLAY UNIT DBM-091 PLEASE READ DESCRIPTION

$479.97



Samsung MX55 Final Drive Motor.  MPN: 7115-15000 picture

Samsung MX55 Final Drive Motor. MPN: 7115-15000

$2100.00



SAMSUNG Mini ER7 Stainless Steel Biopsy Needle Guide, Warranty: 12months picture

SAMSUNG Mini ER7 Stainless Steel Biopsy Needle Guide, Warranty: 12months

$595.50



Genuine SAMSUNG Range Oven Relay Board DG92-01207D picture

Genuine SAMSUNG Range Oven Relay Board DG92-01207D

$99.95



Samsung, KM2816A-25, Integrated Circuit, New, Lot of 15 picture

Samsung, KM2816A-25, Integrated Circuit, New, Lot of 15

$225.00



New In Box SAMSUNG LTM170E8-L01 LCD Display Screen 17-inch picture

New In Box SAMSUNG LTM170E8-L01 LCD Display Screen 17-inch

$145.49







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