Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread Daniel Drozdzewski
On 26 August 2011 11:05, mugurel cosmin  wrote:
> How can i decomrepss a gzip string in java ?

By using appropriate API.

-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread mugurel cosmin
I tried allot of things but non of them work. What could you suggest me to
do ? is it ok to store the gzip into a string from the server ?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread Daniel Drozdzewski
On 26 August 2011 11:17, mugurel cosmin  wrote:
> I tried allot of things but non of them work. What could you suggest me to
> do ? is it ok to store the gzip into a string from the server ?

Sure it is ok.

Did you even try to Google for answer to your question?

It so happens, that Java at least since version 1.4 has native support
for (G)ZIP.

Go and search for the answer, and I promise you will find it.

-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread mugurel cosmin
I`m getting an error of type  java.io.IOException: Not in GZIP format,  when
i use GZIPInputStream

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread Daniel Drozdzewski
On 26 August 2011 11:26, mugurel cosmin  wrote:
> I`m getting an error of type  java.io.IOException: Not in GZIP format,  when
> i use GZIPInputStream

Now we are getting somewhere...

How do you create your GZIPInputStream ?

-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread mugurel cosmin
I`m getting the data from a json array in which i have a gzipped url encoded
string. I`m getting the string url decoding it, converting the string to
bytes array[] , then i create an inputstream from the byte array and
then i`m trying to use GZIPInputStream. In the console i get an error of
unknown format. The server is running UTF-8 and the gzip data is created
with gzcompress from php.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread Daniel Drozdzewski
On 26 August 2011 11:58, mugurel cosmin  wrote:
> I`m getting the data from a json array in which i have a gzipped url encoded
> string. I`m getting the string url decoding it, converting the string to
> bytes array[]     , then i create an inputstream from the byte array and
> then i`m trying to use GZIPInputStream. In the console i get an error of
> unknown format. The server is running UTF-8 and the gzip data is created
> with gzcompress from php.

Few things:

Do you URL encode on the server side?
Do you URLDecode specifying "UTF-8"?
Do you turn the URL decoded String to byte[] also specifying "UTF-8" ?

-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread mugurel cosmin
Yes it is url encode on the server side.


Here is a part of my code:
ArrayList picdata = new ArrayList();
picdata.add((URLDecoder.decode(e.getString("picdata"),"UTF-8")));

InputStream stream = new
ByteArrayInputStream(picdata.get(0).getBytes("UTF-8"));

GZIPInputStream ex = new GZIPInputStream(stream);



The message is unknown format when GZIP.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Decompress GZip string in Java

2011-08-26 Thread Daniel Drozdzewski
On 26 August 2011 12:35, mugurel cosmin  wrote:
> Yes it is url encode on the server side.
>
>
> Here is a part of my code:
> ArrayList picdata = new ArrayList();
> picdata.add((URLDecoder.decode(e.getString("picdata"),"UTF-8")));
>
>                     InputStream stream = new
> ByteArrayInputStream(picdata.get(0).getBytes("UTF-8"));
>
>                     GZIPInputStream ex = new GZIPInputStream(stream);

Any debug?

What is the original string? Then url encoded? then what are the bytes?


-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en