Java URL Download downloadString(String url)

Here you can find the source of downloadString(String url)

Description

download String

License

Open Source License

Declaration

public static String downloadString(String url) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;
import java.net.*;

public class Main {
    public static String downloadString(String url) {
        String s = null;/* w  w w.  java 2  s.c  o  m*/
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
            String ss;
            while ((ss = reader.readLine()) != null)
                s += ss;
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return s;
    }
}

Related

  1. downloadHttp(String downloadURL, String basePath, String commonPathURL)
  2. downloadImg(String urlPath, File file)
  3. downloadMobiFromEpubUrl(String href)
  4. downloadPageSource(String stringURL)
  5. downloadSource(PrintStream out, PrintStream err, String srcURL, String dirStr, boolean extract)
  6. downloadString(URL url)
  7. downloadString(URL url)
  8. downloadText(String url)
  9. downloadTextFromUrl(String url)