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

1N3007A Zener Diode 110v 10w DO-4 +/- 5% Equiv NTE5222A ECG522A SK210 New
$9.99
1N3007A Zener Diode 110v 10w DO-4 +/- 5% Equiv NTE5222A ECG522A SK210 New pictureZener Diode 200 volts 10 watts New
$8.99
Zener Diode 200 volts 10 watts New picture 5pcs HVM12 Microwave Oven High Voltage Diode Rectifier NEW
$0.99
 5pcs HVM12 Microwave Oven High Voltage Diode Rectifier NEW picturePoint-Source Qioptiq Flex-1000 Laser Diode Fiber-Coupled Fiber Optic Guide Cable
$99.95
Point-Source Qioptiq Flex-1000 Laser Diode Fiber-Coupled Fiber Optic Guide Cable pictureCrydom Diode - 3Phase AC to DC - 100Amps 380Vac - M50100TB1000 - NOS
$45.0
Crydom Diode - 3Phase AC to DC -  100Amps 380Vac - M50100TB1000 - NOS picture






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