安卓必备,HttpUrlConnection

【安卓必备,HttpUrlConnection】知识养成了思想,思想同时又在融化知识。这篇文章主要讲述安卓必备,HttpUrlConnection相关的知识,希望能为你提供帮助。

package aaa; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class aaa {public static void main(String[] args) throws IOException { URL url = new URL("https://123.sogou.com/"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); StringBuilder build = new StringBuilder(); BufferedReader read = new BufferedReader(new InputStreamReader(conn.getInputStream())); String s; while ((s = read.readLine()) != null) { build.append(s + "\n"); } String html=build.toString(); } }

 

    推荐阅读