@@ -0,0 +1,1750 @@
+package colomind.com.myownzhihu.Http;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.net.HttpURLConnection;%0Aimport java.net.URL;%0A%0A/**%0A * Created by Administrator on 2016/10/30.%0A */%0A%0Apublic class Http %7B%0A    public static String NEWSLIST_LATEST = %22http://news-at.zhihu.com/api/4/news/latest%22;%0A    public static String STORY_VIEW = %22http://daily.zhihu.com/story/%22;%0A    public static String NEWSDETAIL = %22http://news-at.zhihu.com/api/4/news/%22;%0A%0A    public static String get(String urlARRl) throws IOException%7B%0A        HttpURLConnection con = null;%0A        try %7B%0A        URL url = new URL(urlARRl);%0A        con = (HttpURLConnection) url.openConnection();%0A        con.setRequestMethod(%22GET%22);%0A        con.setRequestProperty(%22User-Agent%22, %22Mozilla/5.0%22);%0A%0A            if (con.getResponseCode() == HttpURLConnection.HTTP_OK) %7B%0A                BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));%0A                String line;%0A                StringBuilder response = new StringBuilder() ;%0A%0A                while ((line = in.readLine()) != null) %7B%0A                    response.append(line);%0A                %7D%0A                in.close();%0A                return response.toString();%0A            %7D%0A            else %7B%0A                throw new IOException(%22Connection Error - Response Code:%22 + con.getResponseCode());%0A            %7D%0A        %7D%0A        finally%7B%0A            if (con != null)%7B%0A                con.disconnect();%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static String getLastNewsList() throws IOException%7B%0A        return get(NEWSLIST_LATEST);%0A    %7D%0A%0A    public static String getNewsDetail(int id) throws IOException%7B%0A        return get(NEWSDETAIL + id);%0A    %7D%0A%7D%0A

完成Http.