从URL获取文本
import java.io.BufferedReader;/** 来 自 时 代 J a v a 公 众 号**/ import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; public class Main { public static void main(String[] args) { try { // Create a URL for the desired page URL url = new URL("http://hostname:80/index.html"); // Read all the text returned by the server BufferedReader in = new BufferedReader(new InputStreamReader( url.openStream()));//from nowjava.com String str; while ((str = in.readLine()) != null) {