January 12, 2011

[SOLVED] Android: Handling gzipped content while downloading

On file download you can check the content type and if its gzipped - unzip it on the fly:

URLConnection connection = url.openConnection();
InputStream stream = connection.getInputStream();
if ("gzip".equals(connection.getContentEncoding())) {
stream = new GZIPInputStream(stream));
}


Source: stackoverflow.com

No comments:

Post a Comment