private void downloadImage(File targetFile) throws IOException { InputStream is = getDownloader().getStream(uri, options.getExtraForDownloader()); try { OutputStream os = new BufferedOutputStream(new FileOutputStream(targetFile), BUFFER_SIZE); try { IoUtils.copyStream(is, os); } finally { IoUtils.closeSilently(os); } } finally { IoUtils.closeSilently(is); } }