hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cheok Yan Cheng <ycch...@yahoo.com>
Subject Re: read and decompress gz file
Date Thu, 26 Apr 2007 16:59:08 GMT
opps, i think i found the bugs inside.

                httpClient.executeMethod(method);
                InputStream inputStream =
method.getResponseBodyAsStream();
                java.util.zip.GZIPInputStream
gZipInputStream = new
java.util.zip.GZIPInputStream(inputStream);
                
                int n = 0;
                
                while((n = gZipInputStream.read(data,
0, data.length)) != -1) {
                    s.append(new String(data, 0, n));
                }
                
                gZipInputStream.close();
                method.releaseConnection();

i should a least specific the length of the byte
during String construction.

p/s do i need to explicitly close the inputStream as well?

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message