Android URL Download downloadUrl(String urlString)

Here you can find the source of downloadUrl(String urlString)

Description

download Url

Declaration

private static InputStream downloadUrl(String urlString)
            throws IOException 

Method Source Code

//package com.java2s;
import java.io.IOException;
import java.io.InputStream;

import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    private static InputStream downloadUrl(String urlString)
            throws IOException {
        URL url = new URL(urlString);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setReadTimeout(10000 /* milliseconds */);
        conn.setConnectTimeout(15000 /* milliseconds */);
        conn.setRequestMethod("GET");
        conn.setDoInput(true);/*from ww  w  .  ja va  2s  .c  o m*/
        // Starts the query
        conn.connect();
        InputStream stream = conn.getInputStream();
        return stream;
    }
}

Related

  1. download(String url, String directoryName, String fileName)
  2. downloadFile(String downloadUrl, String outputFilePath)
  3. downloadFile(URL url, OutputStream output)
  4. downloadHtmlPage(String pageUrl)
  5. getJSONResponseFromURL(String url, Hashtable httpGetParams)
  6. downloadJson(URI uri)
  7. getURLString(String urlStr)
  8. getBytesFromUrl(String url)