日期:2014-05-20 浏览次数:20856 次
import java.io.*; import java.net.*; public class TestURL { public static void main(String[] args) { try { URL url = new URL("http://topic.csdn.net/u/20080201/11/0bd1ec50-a68a-4215-b832-34eecb4e6a3a.html"); try { BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String s = ""; while ((s = br.readLine()) != null) { System.out.println(s); } br.close(); } catch (IOException e) { e.printStackTrace(); } } catch (MalformedURLException e) { e.printStackTrace(); } } }
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream(),"UTF-8"));
------解决方案--------------------
编码问题
------解决方案--------------------
学习