package Test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
public class Main {
public static void main(String[] args) throws Exception {
URL url = new URL("http://www.baidu.com");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(),"utf-8"));
String inputLine;
while((inputLine=in.readLine())!= null){
System.out.println(inputLine);
}
in.close();
}
}
转载于:https://my.oschina.net/u/2526634/blog/546743