Hot answers tagged

4

The API documentation states that the API always returns a compressed response: ...we guarantee that all responses are compressed, either with GZIP or DEFLATE. GZIP is the default. This means that you must send the results from wget to gunzip. Like so: wget -O- <URL> | gunzip > results.json Or, in your specific example: wget -O- "http://api....


2

You're correct in assuming you need dedicated compression support; HttpURLConnection by itself won't be able to process the output. I'm not sure where your problem is, but let me help you with this simple example (using IOUtils from Apache Commons IO). The deCompress method isn't even necessary: if (responseCode == HttpURLConnection.HTTP_OK) { String s; ...


Only top voted, non community-wiki answers of a minimum length are eligible