Hi everyone ,
i have the following problem :
I am working on an application that index web pages. When i read the content of some URLs, BufferedReader. read() blocks, e.g. "http://profile.myspace .com/index.cfm?fusea ction=user.view profile&fri endid=29422575" . All the alternatives that I've found have not solved this problem. This is my java code:
thanks a lot in advance , anyone...?
i have the following problem :
I am working on an application that index web pages. When i read the content of some URLs, BufferedReader. read() blocks, e.g. "http://profile.myspace .com/index.cfm?fusea ction=user.view profile&fri endid=29422575" . All the alternatives that I've found have not solved this problem. This is my java code:
Code:
public static void main(String[] args) throws Exception {
// TODO code application logic here
String _url = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=29422575";
BufferedReader reader = null;
try {
URL url = new URL(_url);
URLConnection urlConnection = url.openConnection();
reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line);
sb.append("\n");
System.out.println(line);
}
// System.out.println(sb.toString());
} catch (Exception ex) {
ex.printStackTrace();
}
}
Comment