package j2se.core.net.base;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
public class URLDemo {
public static void main(String[] args) throws IOException {
URL url = new URL("http://www.google.cn");
InputStream input = url.openStream();
BufferedReader reader = new BufferedReader(
new InputStreamReader(input, "UTF-8"));
while (true) {
String s = reader.readLine();
if (s == null)
break;
System.out.println(s);
}
reader.close();
}
}