java读取网页
package cn.stat.p4.ipdemo; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; public class iedemo { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { String url_str="http://www.baidu.com/"; URL url=new URL(url_str); InputStreamReader ins= new InputStreamReader(url.openStream(), "UTF8"); char[] buf=new char[2024]; int len=0; while((len=ins.read(buf))!=-1) { String text=new String(buf,0,len); System.out.print(text); } ins.close(); } }