Posted By

hyderai on 11/01/11


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

soho100
rpl0264


read file from URL


 / Published in: Java
 

  1. public static String read_file_from_URL(String url){
  2. try{
  3. URL target_url = new URL(url);
  4. target_url.openStream()));
  5.  
  6. String inputLine;
  7.  
  8. while ((inputLine = in.readLine()) != null){
  9. sb.append(inputLine);
  10. sb.append(" ");
  11. }
  12. return sb.toString();
  13. }catch (Exception e) {
  14. // TODO: handle exception
  15. e.printStackTrace();
  16. }
  17. return null;
  18. }

Report this snippet  

You need to login to post a comment.