Android URL Download getURLString(String urlStr)

Here you can find the source of getURLString(String urlStr)

Description

get URL String

License

Open Source License

Declaration

public static String getURLString(String urlStr) 

Method Source Code

//package com.java2s;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import java.net.MalformedURLException;
import java.net.URL;

public class Main {
    public static String getURLString(String urlStr) {
        try {/*from w w  w.j  a  v a  2s.c  o  m*/
            URL url = new URL(urlStr);
            BufferedReader in = new BufferedReader(new InputStreamReader(
                    url.openStream()));
            String inputLine;
            String json = "";
            while ((inputLine = in.readLine()) != null)
                json += inputLine;
            in.close();

            return json;

        } catch (MalformedURLException e) {

        } catch (IOException e) {

        }
        return null;
    }
}

Related

  1. downloadFile(URL url, OutputStream output)
  2. downloadHtmlPage(String pageUrl)
  3. downloadUrl(String urlString)
  4. getJSONResponseFromURL(String url, Hashtable httpGetParams)
  5. downloadJson(URI uri)
  6. getBytesFromUrl(String url)
  7. getWebContent(String pvUrl)
  8. sendPOST(final String myurl, final String paramns)
  9. connectForMultipart(String url)