请问怎么样才能通过IO获得一个网站上网页的代码~~ 如题:请问怎么样才能通过IO获得一个网站上某个网页的代码?要求能够通过IO在我自己做的JSP页面上把其代码显示出来 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 URL u=new URL("http://fuck");InputStreamReader sr = null; try { URL u = new URL(""); ; sr = new InputStreamReader(u.openStream()); BufferedReader br = new BufferedReader(sr); StringBuffer sb = new StringBuffer(); String line; while ( (line = br.readLine()) != null) { sb.append(line); sb.append("\r\n"); } System.out.println(sb.toString()); } catch (IOException ex) { }finally{ try { sr.close(); } catch (IOException ex1) { } } 人机猜拳面向对象代码问题 并发线程的问题 java中给定两个长方形的中心点、长度、宽度,如何判断他们是包含关系还是相交关系,如何编写代码,想了很久…… 某外企 机试题 数组问题 为什么错误提示是:需要<标示符>? 如何象format 硬盘时一样显示当前的进度?? Failed to load Main-class manifest attribute from Test.jar是怎么产生的? 关于JApplet 在java中如何校验一个EMAIL格式的正确性 用java如何实现对等节点之间的socket编程 线程问题
InputStreamReader sr = null;
try {
URL u = new URL(""); ;
sr = new InputStreamReader(u.openStream());
BufferedReader br = new BufferedReader(sr);
StringBuffer sb = new StringBuffer();
String line;
while ( (line = br.readLine()) != null) {
sb.append(line);
sb.append("\r\n");
}
System.out.println(sb.toString());
}
catch (IOException ex) {
}finally{
try {
sr.close();
}
catch (IOException ex1) {
}
}