read file from URL


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.