private void fetch(String res) throws IOException { URL url = new URL(Configuration.composeres() + res); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); con.setDoInput(true); con.setConnectTimeout(5000); con.setRequestProperty( "User-Agent", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11"); ReadableByteChannel rbc = Channels.newChannel(con.getInputStream()); FileOutputStream fos = new FileOutputStream(Configuration.STORAGE_DIR + File.separator + res); fos.getChannel().transferFrom(rbc, 0, 1 << 24); fos.close(); rbc.close(); }