// check for deflate and gzip compression
Header h = m.getResponseHeader("content-encoding");
String encoding = (h == null) ? null : h.getValue();
if (encoding != null && encoding.equals("deflate")) {
InputStream is = new BufferedInputStream(new InflaterInputStream(m.getResponseAsStream()), 10000);
nbytes = IO.appendToFile(is, file.getPath());
} else if (encoding != null && encoding.equals("gzip")) {
InputStream is = new BufferedInputStream(new GZIPInputStream(m.getResponseAsStream()), 10000);
nbytes = IO.appendToFile(is, file.getPath());