Return to Snippet

Revision: 52766
at November 1, 2011 14:44 by hyderai


Initial Code
public static String read_file_from_URL(String url){
		try{
		  URL target_url = new URL(url);
		  BufferedReader in = new BufferedReader(
		        new InputStreamReader(
		        target_url.openStream()));

		  StringBuffer sb = new StringBuffer();
		  String inputLine;

		  while ((inputLine = in.readLine()) != null){
				sb.append(inputLine);
				sb.append(" ");
		  }
		  return sb.toString();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return null;
	}

Initial URL

                                

Initial Description

                                

Initial Title
read file from URL

Initial Tags

                                

Initial Language
Java